source file name: arravg.C
void main()
{
int i,n,sum=0,avg;
int A[20];
clrscr();
printf("\n enter marks out of 25 ");
printf("enter no. of students attempted in Test <20:\n");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\n enter marks of %d student: ",i+1);
scanf("%d",&A[i]);
}
for(i=0;i<n;i++)
{
sum=sum+A[i];
}
avg=sum/n;
printf("\n average marks of %d students is: %d ",n,avg);
getch();
}
output:
0 Comments
Post a Comment