Answered You can hire a professional tutor to get the answer.

QUESTION

I am trying to code a program in C that will calculate the average of 3 exams for an undetermined # of students.

I am trying to code a program in C that will calculate the average of 3 exams for an undetermined # of students. I have been given a base code that I must modify using a sentinel that will stop the loop counter. I can not seem to code the loop to accept the break. I do not want to simply enter the number of students.

Base Code: 

#include <stdio.h>int main (){ /* variable definition: */ char StudentName[100]; float ExamValue, Sum, Avg; int students,exams;// Loop through 5 Students for (students=0; students <5 ; students++) {// reset Sum to 0Sum =0.0; printf("Enter Student Name n");// Nested Loop for Examsfor (exams=0; exams < 3; 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;}#include &lt;stdio.h&gt;int main(void) {/* variable definition: */char StudentName[100];float ExamValue, Sum, Avg;int students,exams;// loop until user enters a sentinel valuedo{// reset...
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question