Program to accept 10 nos from the user,store in array & find avg of no.

void main()
{
int a[10],i,sum=0;
float avg;
clrscr();
printf("Enter the number");
for(i=0;i<10;i++)
{
scanf("%d",&a[i]);
sum=sum+a[i];
}
avg=sum/10;
printf("Sum=%d",sum);
printf("Average=%d",avg);
getch();
}

No comments:

Post a Comment