Answer to Question #292514 in C for Muskan

Question #292514

Write a program that takes as input a class score. Output the grade for the class based on the


following guideline:


 Exactly 100 is A+


 90and above is A


 80 and above is B


 70 and above is C


 60 and above is D


 Anything less than 60 is F


 Anything more than 100 or less than 0 is invalid input.

1
Expert's answer
2022-02-02T05:09:36-0500
#include <stdio.h>


void main(){
	int score;
	printf("Enter score[0-100]: ");
	scanf("%d",&score);
	if (score==100){
		printf("Grade: A+\n");
	}
	else if (score >= 90 && score < 100)
	{
		printf("Grade: A\n");
	}
	else if (score >= 80 && score <= 89)
	{
		printf("Grade: B\n");
	}
	else if (score >= 70 && score <= 79)
	{
		printf("Grade: C\n");
	}
	else if (score >= 60 && score <= 69)
	{
		printf("Grade: D\n");
	}
	else if (score >= 0 && score <= 59)
	{
		printf("Grade: F\n");
	}else{
		printf("Invalid input.\n");
	}


	scanf("%d",&score);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS