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

Popular posts from this blog

Write a program to check if a number is prime or not.

write a program (keep taking numbers as input from user until user enters an Odd number)

write a program to print all the odd numbers from 1 to 100.