CJCoding With Joseph
← Back to Question List
C Code Walkthrough #25

Nested Ternary as a Grader

mediumOperators

📄 Code

Read carefully — what does this print?
1#include <stdio.h>
2int main() {
3 int score = 75;
4 char grade = (score >= 90) ? 'A'
5 : (score >= 80) ? 'B'
6 : (score >= 70) ? 'C' : 'F';
7 printf("%c\n", grade);
8 return 0;
9}

🎯 Your Answer