Write a C program in the C programming language to find the average of three numbers. Below is the solution of the program –
Input-
Enter three numbers to find their average – 23 64 33
Output –
Average of three numbers is – 40.000
01 | /*C program to find the average of three numbers*/ |
02 | #include<stdio.h> |
03 | void main() |
04 | { |
05 | float a,b,c,av=0; |
06 |
07 | printf("Enter any three numbers to find their average \n"); |
08 | scanf("%f%f%f",&a,&b,&c); |
09 |
10 | av=(a+b+c)/3.0; |
11 |
12 | printf("\n Average of three numbers is \t %f",av); |
13 | getch(); |
14 | } |
Input-
Enter three numbers to find their average – 23 64 33
Output –
Average of three numbers is – 40.000

0 comments:
Post a Comment