P

Priyanka Tomar • 35.28K Points
Coach

Q. What is the output of the following code snippet? int x = 10; int y = 20; cout << (x != y ? x : y);

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

Explanation by: Priyanka Tomar
The ternary operator returns x if x is not equal to y, which is 10.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics