#include <stdio.h>
#include <conio.h>
void main()
{
int n,a[100],i,sum=0;
float avg;
printf("Enter quantity(1 to 100):");
scanf("%d",&n);
printf("Enter %d numbers\n",n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
sum=sum+a[i];
}
avg=float(sum)/i;
printf("Average is %f",avg);
getch();
}
OUTPUT:
No comments:
Post a Comment