Write C Program Gradec Includes Function Calculateaverage Calculate Average Arbitrary Numb Q43826010
write a C program, grade.c, which includes a function,
calculateAverage(), that can calculate the average ofan arbitrary number of test scores.
your program will not know in advance how many test scores willbe entered into your function
so you will need to use a sentinel value (-1) to terminate thewhile loop used to collect the test scores.
the test scores are integers in the range 0 to 100 and the testscore average should be output to two decimal places.
be sure that the user prompts and grades input into the programare displayed in the output file.
provided below is the main() function that I would likeyou to use for your program:
int main (void){
int I;
fopen_s(&fp, “csis.txt”, “w”);
for (i = 1; i <= 4; ++i) {
calculateAverage();
}
fclose(fp);
return 0;
}
please do not modify the main() function. it shouldappear as the first function in the program.
Be sure to use function prototypes for each of the functionsthat are used in your program.
Note that the first for loop invokes thecalculateAverage() function four times.
Each time the calculateAverage() function is invoked, adifferent set of test grades will be entered.
Please be sure to use the data shown below.
First: 78, 93, 45, 88, 89, -1
second: 87, 68, 100, -1
third: 84, 86, 90, 86, 96, 68, 82, -1
fourth: -1
Be sure that your code does not attempt to divide by zero forthe fourth run of the program.
Expert Answer
Answer to write a C program, grade.c, which includes a function, calculateAverage(), that can calculate the average of an arbitrar…
OR