C program to find the average of three numbers - Anna University Multiple Choice Questions

C program to find the average of three numbers

Aim:

To write a c program to find the average of three numbers

Algorithm:

1.Start the program
2.Get three numbers from the users
3.Add three numbers and divide it by 3
4.Print the average value
5.Stop the program

C Program - Average of three numbers

#include<stdio.h>

#include<conio.h>
void main()
{
int n1,n2,n3;
float average;
clrscr();
printf("Enter the three numbers");
Scanf("%d %d %d",&n1,&n2,&n3);
average =(n1+n2+n3)/3.0;
printf("average of above three numbers is %.4f",average);
getch();
}

Output for  Average of three numbers C program

Enter three numbers
56
78
93
Average of above three numbers is 75.6667

Result
Thus the C program to find the average of three numbers is written and executed successfully.