## Write A Program That Will Calculate A Student’s Quiz Average

• 4th Sep, 2020
• 14:46 PM

Programming Assignment Question - Write A Program That Will Calculate A Student’s Quiz Average.

Programming Assignment Solution -

Greater than or equal to 90 A
Greater than or equal to 80 B
Greater than or equal to 70 C
Greater than or equal to 60 D
Otherwise F
The input prompts and output statements must match the sample execution below.

Sample Executions:

Quiz Calculator
How many quizzes: 4
Your quiz average is 90.500000, A
Quiz Calculator
How many quizzes: 2
Your quiz average is 80.000000, B

Sample Executions:
Quiz Calculator
How many quizzes: 3
I think you made a mistake!
I think you made a mistake!
Your quiz average is 48.333332, F

Solution

```netIDprog4.c

#include

int main() {

int quizzes; //to store total quiz

floattotalScore = 0.0, score; //toal score and individual score

printf(“How many quizzes: “);

scanf(“%d”, &quizzes);

// for each quiz

for (int i = 1; i <= quizzes; ++i) {

do {

printf(“Enter quiz %d grade: “, i);

scanf(“%f”, &score);

if (score < 0 || score > 100) { //if invalid

printf(“I think you made a mistake!\n\n”);

}

} while (score < 0 || score > 100); //continue while invalid

totalScore += score;

}

//calculate average

float average = totalScore / quizzes;

if (average >= 90)

else if (average >= 80)

else if (average >= 70)

else if (average >= 60)