- Write a program that a prof can use to enter the test marks of several students and which calculates the average mark of each student. Ask the user how many students he has, then ask him to enter each student's marks. When 999 is entered, calculate the average mark for that student (not counting the 999) and print the average. Then go on to the next students until the marks for all students have been entered, calculated and the average printed.
Code:
#include<stdio.h>
main()
{
float student,mark,total=0;
float a,b,c;
int num = 999;
printf("\nPlease enter how many students you have: " );
scanf("%f",&student);
do {
printf("\nPlease enter each student's marks: ");
scanf("%f",&mark);
total = total + mark;
} while(mark!=num);
a = total - 999;
b = a / (student*100);
c = b * 100;
printf("\nThe average is %.2f%%.",c);
getch();
}
Could you please give some suggestion about this program?