Write a program find out the average mark of n students.
Program:
#include<stdio.h>
main(){
int n,i,mark;
float avg,sum=0;
printf("Enter total students: N= ");
scanf("%d", &n);
for(i=1; i<=n; i++)
{
printf("Mark for [ID %d]=", i);
scanf("%d", &mark);
sum=sum+mark;
}
avg=sum/n;
printf("Average =%.2f", avg);
}
Program:
#include<stdio.h>
main(){
int n,i,mark;
float avg,sum=0;
printf("Enter total students: N= ");
scanf("%d", &n);
for(i=1; i<=n; i++)
{
printf("Mark for [ID %d]=", i);
scanf("%d", &mark);
sum=sum+mark;
}
avg=sum/n;
printf("Average =%.2f", avg);
}