C Program To Find The Average Of n Numbers

How to write a C Program To Find The Average Of n Numbers in C Programming Language ?

Solution For C Program:

/*C Program To Find The Average Of n Numbers*/

#include<stdio.h>
void main()
{
int n, count;
float sum = 0, x, avg;
printf("\nEnter How Many Numbers : ");
scanf("%d", &n);
for(count = 1; count <= n; count++)
{
printf("x = ");
scanf("%f", &x);
sum += x;
}
avg = sum / n;
printf("\nThe Average of Numbers is : %0.2f", avg);
}

You may also learn these C Program/Code :

C Program To Swap Two Numbers Without Using Third Variable


Learn More :