Answer to Question #292515 in C for Muskan

Question #292515

Write a program that accepts a letter grade as input and outputs the teacher’s remarks. Use


only switch, do not use any if’s. Example: If ‘A’or ‘a’, then “Excellent job!”. If ‘F’ or ‘f’, then “You


failed. Please study more next time”.

1
Expert's answer
2022-02-02T11:48:41-0500




#include <stdio.h>


void main(){
	char letterGrade;
	printf("Enter letter grade: ");
	scanf("%c",&letterGrade);
	switch(letterGrade){
	case 'a':
	case 'A':
		printf("Excellent job!\n");
		break;
	case 'b':
	case 'B':
		printf("Good job!\n");
		break;
	case 'c':
	case 'C':
		printf("Fair job!\n");
		break;
	case 'd':
	case 'D':
		printf("Poor job!\n");
		break;
	case 'f':
	case 'F':
		printf("You failed. Please study more next time!\n");
		break;
	default:
		printf("Invalid input.\n");
		break;
	}


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

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