#include<stdio.h>
main() {
int a;
printf("Enter
the Number: \t");
scanf("%d",&a);
if(a < 30)
printf("Grade
C\n",a);
else
if(a < 40)
printf("Grade
B\n");
else
if(a <= 50)
printf("Grade
A\n");
else
printf("The
Enter Number is more than 50\n");
}
Output
Enter the No. 35
Grade B
How it works
When user enters the input it checks if it is less than 30 or not. If yes then it prints Grade C. Similarly if its value is greater than that, then it prints Grade B or Grade A. But it shows invalid value if entered value is greater than 50.