Result of following expression ans-val > 500 ? 150 : 50

Q26. What will be the result of following expression if

  1. ans=700, val=300
  2. ans=800, val=700

ans-val > 500 ? 150 : 50

Ans.

  1. ans=700, val=300

ans – val < 500 ? 150 : 50

700 – 300 < 500 ? 150 : 50

400 < 500 ? 150 : 50

150 

2. ans=800, val=700

ans – val < 500 ? 150 : 50

800 – 700 < 500 ? 150 : 50

100 < 500 ? 150 : 50

150

 

Leave a Reply

Your email address will not be published. Required fields are marked *

4 Views
%d bloggers like this: