Write a program for Students mark sheet with multiple subject.
Program:
#include<stdio.h>
main(){
int n,i,j,mark,subject;
float avg,sum=0;
printf("Enter total students: N= ");
scanf("%d", &n);
for(i=1; i<=n; i++)
{
printf("\n\n Number of subject for [Id %d] = ", i);
scanf("%d", &subject);
sum=0;
for(j=1; j<=subject; j++)
{
printf("Enter marks for [subject %d] = ",j);
scanf("%d", &mark);
sum=sum+mark;
}
avg=sum/subject;
printf("\Average Mark of [Id %d]= %.2f", i,avg);
}
}
Program:
#include<stdio.h>
main(){
int n,i,j,mark,subject;
float avg,sum=0;
printf("Enter total students: N= ");
scanf("%d", &n);
for(i=1; i<=n; i++)
{
printf("\n\n Number of subject for [Id %d] = ", i);
scanf("%d", &subject);
sum=0;
for(j=1; j<=subject; j++)
{
printf("Enter marks for [subject %d] = ",j);
scanf("%d", &mark);
sum=sum+mark;
}
avg=sum/subject;
printf("\Average Mark of [Id %d]= %.2f", i,avg);
}
}