Write a C programthat will take three numbers from user and find their average.

Write a C program in the C programming language to find the average of three numbers. Below is the solution of the program –





01/*C program to find the average of three numbers*/
02#include<stdio.h>
03void 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
Share on Google Plus

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment