Write a program to print the average of 3 numbers.
//program to print the average of 3 numbers.
#include<stdio.h>
#include<math.h>
int main()
{
int a,b,c;
printf("enter three numbers");
scanf("%d%d%d", &a,&b,&c);
printf("Average of three numbers =%d",(a+b+c)/3);
//Average = sum of numbers / total number of values.
return 0;
}
Output :
enter three numbers
9
8
7
Average of three numbers =8
--------------------------------
Process exited after 7.005 seconds with return value 0
Press any key to continue . . .
Comments
Post a Comment
Please do not enter any spam link in the comment box.