C Program to find the average of three numbers

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

/*C program to find the average of three numbers*/
#include<stdio.h>
void main()
{
     float a,b,c,av=0;

     printf("Enter any three numbers to find their average \n");
     scanf("%f%f%f",&a,&b,&c);

     av=(a+b+c)/3.0;

     printf("\n Average of three numbers is \t %f",av);
     getch();
}

Input-
Enter three numbers to find their average – 23   64   33

Output –
Average of three numbers is – 40.000

yashan has written 70 articles

11 thoughts on “C Program to find the average of three numbers

  1. Jubilant Ojika says:

    #include. . . . . .1 void main (). . . . . . . . . . .2 {. . . . . . . . . . . . . . . . . . . . . 3 int x, y, z, ave; . . . . . . . 4 scanf(“%d %d %d”, &x, &y, &z); . . . . . . . . . . . . . . 5 ave = (5+2+9)/3; . . . . .6 printf(“the average is =%d”, ave); . . . . . . . . . . . . 7 }

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>