Grade Calculator
Completed
Read a score 0–100 and print A (90+), B (75+), C (50+) or F.
Input
One integer.
Output
One letter.
Example
Input
95
Output
A
Editor
C
Hints
Check from the highest band down.
Solution explanation
Only the first true branch of an else if chain runs.
Show solution
#include <stdio.h>
int main() {
int s;
scanf("%d", &s);
if (s >= 90) {
printf("A\n");
} else if (s >= 75) {
printf("B\n");
} else if (s >= 50) {
printf("C\n");
} else {
printf("F\n");
}
return 0;
}