Give the output of the following: int x = (4>3)?4*3:3*4;
Answers
Answered by
0
Answer:
12
Explanation:
a ? b : c is the same as If a then b, else c.
So your question is the same as
If 4 > 3 then 4*3 else 3*4.
This is of course an easy computation.
4 is greater than 3 so 4>3 is True. Then it will return 4*3 which evaluates to 12. Thus it simply returns 12.
Note that even if 4>3 was False (which it isn't) it would still return 3*4 which also is 12.
Similar questions
Biology,
2 months ago
Math,
2 months ago
India Languages,
5 months ago
Math,
10 months ago
Science,
10 months ago