1
visibility

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

  • 1400

  • 400

  • 1000

  • 200

When val = 1000, val + 550 = 1550. As 1550 is less than 1700 so condition of ternary operator is true. Variable c is assigned the value of expression 1 which is 200.