What is the value of variable ans after evaluating
the following statement if ans = 200 initially:
ans = (ans >= 180) ? ans++ : ++ans;
Answers
Answered by
1
ANSWER.
- The value of the variable 'ans' is 200.
EXPLANATION.
- Here, the initial value of 'ans' is 200.
- So, ans>=180 is true as 200>=180 is true.
- So, ans = ans++ or ans = 200 (post-increment).
- Therefore, the final value of 'ans' is 200.
Similar questions
Computer Science,
14 days ago
Biology,
14 days ago
Math,
14 days ago
Science,
8 months ago
Math,
8 months ago