Home / Programs / Write a program in C that prints the grade according to the score secured by a student
Programming Example

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

👁 1,415 Views
💻 Practical Program
📘 Step by Step Learning
Write a program in C that prints the grade according to the score secured by a student

Program Code

#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

<b>Output 1:</b>
 ENTER SCORE : 82
GRADE IS: B

<b>Output 2:</b>

 ENTER SCORE : 96
GRADE IS: A

Explanation

None

How to learn from this program

First read the algorithm, then study the program code line by line. After that, compare the code with the output and finally go through the explanation. This approach helps learners understand both the logic and the implementation properly.