Question discussion

What will be the output of the following code?

359241Medium DSSSB TGT Computer Science 0 replies 0 views
0
What will be the output of the following code?
#include <stdio.h>
int main() {
    int a = 10, b = 20;
    int max = (a > b) ? a : b;
    printf("%d", max);
    return 0;
}
  • A30
  • Bcompile time error
  • C10
  • D20
Correct answer: D

Explanation

a > b is false, so max = b = 20.

Discussion 0

Nobody has replied yet. Start the discussion!