Responsive Advertisement


C Program to Calculate the average of three numbers > Shout Coders


* Write a Program and Algorithm to find the Average of three Number by using C Program.

Algorithm :

  1. Start
  2. Read the value of num1 ,num2,num3 and Avg.
  3. Enter the value of num1.
  4. Enter  the value of num2.
  5. Enter the value of num3.
  6. Calculation, Avg=(num1+num2+num3)/3;
  7. Print the value of average of three number "Avg".
  8. Stop.

Program  :

#include<stdio.h>
#include<conio.h>
void main()
{
 int num1,num2,num3,Avg;
clrscr();
printf( "Enter the value of number 1 and number 2 and number 3" );
scanf("%d%d%d",&num1,&num2,&num3);
Avg=(num1+num2+num3)/3;
printf( " Average of three number :: ",Avg);
getch();
}

              output
 Enter the value of number 1 and number 2 and number 3 = 11 ↲
22 ↲ 33 ↲
Division of two number:: 22
Responsive Advertisement

No comments:

Post a Comment

Pages