C program to find average of list of numbers entered through keyboard

#include<stdio.h>
#include<conio.h>

void main()
{
int i,n,sum=0,e;
float avg;
clrscr(); //to clear the screen

  printf(“How many elements:”);
scanf(“%d”,&n);
printf(“Enter all the elements one by one:”);
for(i=0;i<n;++i)
{
scanf(“%d”,&e);
sum+=e;
}
avg=sum/n;
printf(“nAverage=%f”,avg);
getch(); //to stop the screen
}

1 thought on “C program to find average of list of numbers entered through keyboard”

Leave a Comment

Your email address will not be published. Required fields are marked *