C Program to Find the Average of Three Numbers

Average is found out by adding all the numbers and dividing it by the total number of numbers.

  1. // C program to find the average of three numbers
  2. #include<stdio.h>
  3. void main()
  4. {
  5. float a,b,c, av=0;
  6. printf("Enter any three numbers to find their average \n");
  7. scanf("%f%f%f",&a,&b,&c); // taking input as float
  8. av=(a+b+c)/3.0; // adding and dividing simultaneously
  9. printf("\n Average of three numbers is \t %f",av); // printing the result
  10. getch();
  11. }