Write a program in C that prints the grade according to the score secured by a student

C Programming Language / Decision Making of C Language

1387

Program:

#include <stdio.h>
int main()
{
	int score;
	char grade;
	printf("\n ENTER SCORE : ");
	scanf("%d", &score);
	if(score >= 90)
		grade = 'A';
	else if(score >= 80)
			grade = 'B';
		 else if(score >= 70)
				grade = 'C';
			  else if(score >= 60)
						grade = 'D';
				   else
						grade = 'F';
	printf("GRADE IS: %c", grade);
	
	getch();
	return 0;
}

Output:

Output 1:
 ENTER SCORE : 82
GRADE IS: B

Output 2:

 ENTER SCORE : 96
GRADE IS: A

Explanation:

None

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.