Kodewick
Start learning →
Basic←→0 / 50

Letter grade

#005Basicscore >= 90 ? 'A'4 min

Turn a score into a grade: 90 and up is 'A', 60 to 89 is 'B', below 60 is 'C'. Write grade(score) to return the grade, so grade(72) is 'B'. This classic problem uses the conditional operator ? :. Try to do it in one line.

Examples
grade(95)→'A'
grade(72)→'B'
grade(45)→'C'
The functionchar grade(int score)
main.c
char grade(int score) {
    char g = '?';
    // your code here: use ? : to give g a grade from the score
    return g;
}
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.