Answer to Question #294728 in C for ctx

Question #294728

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-07T12:50:39-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 '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