Output of the following program ismain(){int i=0;for(i=0;i<20;i++){switch(i){case 0:i+=5;case 1:i+=2;case 5:i+=5;default:i+=4;break;}}}A. 5,9,13,17B. 12,17,22C. 16,21D. syntax error.

Showing Answers 1 - 3 of 3 Answers


  • Jan 31st, 2006

option:cfirst enter the loop with i value i=0,then enters switch statement.then case 0 is selected.theis break statement for case 0,so case1 also executed,same as for all casee,after default i becomes 16,goto for statement.condition is true,then select default case,just it is incremented by 4,then it becomes to 21.


  • Jul 20th, 2016

Rekha can you please elaborate the answer.

  Was this answer useful?  Yes


  • Sep 6th, 2016


  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions