What will be printed by the following code? int main() {
What will be printed by the following code?
#include<stdio.h>
int main() {
int marks = 75;
char grade = (marks >= 90) ? 'A' : (marks >= 70) ? 'B' : 'C';
printf("%c", grade);
return 0;
}
Show answerHide answer
Correct answer: (A) B
Explanation
75 >= 90 is false, so the second condition is checked: 75 >= 70 is true, so grade is 'B'.