Answer to Question #288592 in C for dsurya

Question #288592

using switch case print the grade of the student




1
Expert's answer
2022-01-18T13:02:37-0500
#include<stdio.h>
int main()
{
	int score;


	printf("Enter score( 0-100 ): ");
	scanf("%d", &score);


	switch( score / 10 )
	{


	case 10:
	case 9:
		printf("Grade: A");
		break;


	case 8:
		printf("Grade: B");
		break;


	case 7:
		printf("Grade: C");
		break;


	case 6:
		printf("Grade: D");
		break;


	case 5:
		printf("Grade: E");
		break;


	default:
		printf("Grade: F");
		break;


	}




	getchar();
	getchar();
	return 0;
}

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