Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

More Books

Students also viewed these Databases questions

Question

What are the organizations task goals on this issue?

Answered: 1 week ago