P

Priyanka Tomar • 35.28K Points
Coach

Q. What is the output of the following code snippet? int a = 10; int b = 20; cout << (a > b ? a : b);

  • (A) 10
  • (B) 20
  • (C) 0
  • (D) Error
  • Correct Answer - Option(B)
  • Views: 44
  • Filed under category C++

Explanation by: Priyanka Tomar
The ternary operator returns the greater value between a and b, which is 20.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics