1
visibility

Predict the output ?
c = (val + 550 < 1700)? 200: 400; if: val = 1500

  • 1700

  • 400

  • 200

  • 2050

When val = 1500, val + 550 = 2050. As 2050 is greater than 1700 so condition of ternary operator is false. Variable c is assigned the value of expression 2 which is 400.