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 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;
}

                        

🖥 Program Output

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

<b>Output 2:</b>

 ENTER SCORE : 96
GRADE IS: A
                            

📘 Explanation

None
📚 Learning Subject

Master Programming Through Practical Examples

Improve your coding logic, problem-solving skills and programming confidence by practicing real-world examples with explanations.

🎯 How to learn from this example

First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.

🔥 Practice suggestion

Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.