Given the following test scores and grade equivalents, write a function which is
ID: 3551975 • Letter: G
Question
Given the following test scores and grade equivalents, write a function which is passed a score, and returns a letter grade based on write a function
which is passed a score, and returns a letter grade based on
the score entered. A number less than 0 or greater than 100 is invalid.
Score Grade
------ -----
90-100 A
80-89 B
70-79 C
60-69 D
0 -59 F
Please make it the code easy to read in beginners C language
Explanation / Answer
char grade(int score)
{
//Returns 'G' if score is invalid
if(score>100)
return 'G';
else if(score>=90)
return 'A';
else if(score>=80)
return 'B';
else if(score >=70)
return 'C';
else if(score >=60)
return 'D';
else if(score >=0)
return 'F';
else
return 'G';
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.