Find out the average mark, number of N students using array.
Program:
#include<stdio.h>
main()
{
int n, i, sum=0, m[50];
float avg;
printf("Enter students: N= ");
scanf("%d", &n);
i=0;
while(i<n)
{
printf("Enter mark for [id %d]= ", i);
scanf("%d", &m[i]);
sum=sum+m[i];
i++;
}
avg=sum/n;
printf("Avarage=%.2f", avg);
}
Program:
#include<stdio.h>
main()
{
int n, i, sum=0, m[50];
float avg;
printf("Enter students: N= ");
scanf("%d", &n);
i=0;
while(i<n)
{
printf("Enter mark for [id %d]= ", i);
scanf("%d", &m[i]);
sum=sum+m[i];
i++;
}
avg=sum/n;
printf("Avarage=%.2f", avg);
}