What would be the output of the code?
Correct answer
Explanation:
Initially i = 0. Since case 0 is true i becomes 5, and since there is no break statement till the last statement of the switch block, i becomes 16. Now in the next iteration, no case is true, so execution goes to default and i becomes 21.
0 comments:
Post a Comment