This is a C program to find average of N numbers. Generally average is calculated as the sum of all the numbers divided by total numbers. Average = (n1+n1+.........)/N |
PROGRAM :
#include <stdio.h> #include <stdlib.h> int main() { int n,i,numbers,sum=0; float avg; printf("Enter how many numbers do u want find the average :\t"); scanf("%d",&n); for(i=1;i<=n;i++) { printf("\tEnter number %d \t",i); scanf("%d",&numbers); sum=sum+numbers; } avg= sum/n; printf("\n\tAverage of %d numbers you have entered is : %f",n,avg); return 0; }OUTPUT :
C - Average of N numbers |