The original program is supposed to ask the user to enter 3


The original program is supposed to ask the user to enter 3 grades for 5 students, and then calculate the average for each student and for each exam:
(MODIFICATIONS AT BOTTOM)

_______________________________________________________________________________________
#include
int main()
{
int grades[5][3];
int student, exam;
int sum;
float average;
for (exam=0; exam<3; exam++){
printf(" Exam %i \n", exam+1);
printf("-----------------------\n");
for( student = 0; student < 5; student++){
printf("Grade for student %i: ", student + 1);
scanf("%i", &grades[student][exam]);
}
printf("\n"); }
printf("\n");
for (exam=0; exam < 3; exam++){
sum = 0;
for( student = 0; student < 5; student++){
sum += grades[student][exam];}
average = sum / 5.0;
printf("The average for exam %i is: %3.2f \n", exam + 1, average);
}
printf("\n");
for( student = 0; student < 5; student++){
sum = 0;//make sure the sum is cleared when we start a new average
for (exam= 0; exam < 3; exam++){
sum += grades[student][exam];}
average = sum / 3.0;
printf("The average for student %i is: %3.2f \n", student + 1, average);
}
printf("\n");
return 0;
}

 

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: The original program is supposed to ask the user to enter 3
Reference No:- TGS0644894

Expected delivery within 24 Hours