it is a single number that is used to represent a collection of
numbers.
Average =Sum/Count
|
#include<stdio.h>
int main()
{
int a,b,c,d;
float avg;
printf("Enter
four numbers:\n");
scanf("%d%d%d%d",&a,&b,&c,&d);
avg=(a+b+c+d)/4.0; //4.0 is for type casting
printf("Average=%f\n",avg);
}
OUTPUT:
Enter four
numbers:
25
65
45
88
Average=55.750000
No comments:
Post a Comment
For any doubt or suggestion you can write here