C = (val + 500 < 1700) ? 200 : 400; if (a) val = 1000 (b) val = 1500
Answers
Answered by
4
Answer (a) Val = 1000 :-
(a) 200
Explanation :-
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.
Answer (b) Val = 1500 :-
(b) 400
Explanation :-
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.
PLEASE MARK ME AS A BRAINLIEST ❤
Similar questions