Question: Please answer, will rate! A test consists of 8 multiple choice questions, each of which has three possible answers. The first answer is four points,

Please answer, will rate!

A test consists of 8 multiple choice questions, each of which has three possible answers. The first answer is four points, the second one, and the third three points. Write a C program that uses switch statement to read eight answers from the test and display final score.

This is my code, help me solve my error. It does not compute anything.

#include int main(){ int total_grade=0; int grades[8]; int maxcount=8; int i; printf("Enter the 8 multiple choice selections: "); scanf("%d ",&grades[8]); for(i = 0; i < maxcount; i++){ switch(grades[i]){ //4 points case '1': total_grade+=4; break; //1 point case '2': total_grade+=1; break; //3 points case '3': total_grade+=3; break; } } printf("%d ",total_grade); return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!