Advertisement

Program of ‘n’ Numbers of Average:


#include<stdio.h>
#include<conio.h>
void main()
{
int n,count=1;
float x,avg,sum=0;
clrscr();
printf("numbers::");
scanf("%d",&n);
while(count<=n)
{
printf("x=");
scanf("%f",&x);
sum+=x;
++count;
}
avg=sum/n;
printf("\n the average is %f\n",avg);
getch();
}

No comments:

Post a Comment

Please comment bellow. Share your knowledge