Find the output from following program? int main() { int a = 10, b; a > =5 ?…

Find the output from following program?

int main()

{

int a = 10, b;

a > =5 ? b=100: b=200;

printf("%d\n", b);

return 0;

}

Answer: A. 100a = 10 Condition: a >= 5 → true So, b = 100 Therefore, output is: 100

  1. A.

    100

  2. B.

    200

  3. C.

    Error: L value required for b

  4. D.

    Garbage value

Attempted by 35 students.

Show answer & explanation

Correct answer: A

a = 10

Condition:
a >= 5 → true

So,
b = 100

Therefore, output is:

100

Explore the full course: Coal India Management Trainee

Loading lesson…