The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
 I need This program to calculate the average of 3 exams for 5 students. The program will ask the user to enter 5 student names. For each of the students, the program will ask for 3 exam scores. The average examscore for each student will be calculated and printed.
the code needs to be the same i really just need to know how to loop the different score and names because if i input my name into the students name section it just does the question over and over
Â
#includeÂ
int main ()
{
/* variable definition: */
char StudentName[100];
float ExamValue, Sum, Avg;
int students,exams;
// Loop through 5 Students
for (students=0; students {
// reset Sum to 0
Sum =0.0;
printf("StudentName n");
scanf("%s", StudentName);
// Nested Loop for Exams
for (exams=0; exams {
printf ("Enter exam grade: n");
scanf("%f", &ExamValue);
Sum += ExamValue;
}
Avg = Sum/3.0;
printf( "Average for %s is %fn",StudentName,Avg);
}
return 0;
}
Â
Â