4 4 votes Programming in C programming-in-c loop + – Don't you worry 2.2k views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
Best answer 2 2 votes Answer is option D] for a given code, Out put will be : 012345678910111213141516171819 Option A will result in : 012345678910111213141515151515151515.... Option B will result in : 0123456789101112131415 Option C : x variable has to be initialized first. Option D : 012345678910111213141516171819 Hence the answer. The continue skips the statements after it. And continues with next iteration. Desert_Warrior answered Jun 22, 2016 • edited Jul 13, 2016 by Desert_Warrior Desert_Warrior comment Share Follow See all 12 Comments 12 12 Comments reply srestha commented Jun 22, 2016 reply Follow flag how 15 is comparing in each options? 1 1 replyShare Desert_Warrior commented Jun 22, 2016 reply Follow flag answer edited.. 0 0 replyShare srestha commented Jun 23, 2016 i edited by srestha Jun 23, 2016 reply Follow flag ok yes A and B both will cause compilation error rt? 0 0 replyShare shekhar chauhan commented Jul 12, 2016 reply Follow flag @lord Krishna can you explain what does this line is doing in the for loop count<<j ; and what is the role of continue statement here? 0 0 replyShare Kapil commented Jul 12, 2016 reply Follow flag we use cout<<j in c++ to print values of j in the terminal. it is here doing the same thing .. 0 0 replyShare shekhar chauhan commented Jul 12, 2016 reply Follow flag @kapil i thought it would be something related to left shift or right shift . then what about the continue statement. if we don't use this statement would it give us a different o/p. 0 0 replyShare Kapil commented Jul 12, 2016 reply Follow flag sir, continue will directly go to the increment condition and then test it and then print 0 0 replyShare shekhar chauhan commented Jul 12, 2016 reply Follow flag @kapil you mean next iteration rt ? so to next increment condition we can go without it so what is the significance of using it here ? 0 0 replyShare Kapil commented Jul 12, 2016 reply Follow flag yes, if we dont use it , result will be same. if there were statements after continue they wont execute. 0 0 replyShare shekhar chauhan commented Jul 12, 2016 reply Follow flag @kapil lordkrishna has written a line at the end of his solution can you tell me something about it ? if you know it 0 0 replyShare Kapil commented Jul 12, 2016 reply Follow flag sir, what continue does? it directly takes the control from current execution statement to increment condition . after incrementing , it tests it and then goes again in the loop... so , now in this process, if there were any statements after continue will be skipped take example of variable named k, and we are decrementing k after continue, so because of this continue , it will be skipped. hence , continue skips some statements inside the loop 1 1 replyShare Desert_Warrior commented Jul 13, 2016 reply Follow flag hey @shekhar chauhan , The continue skips the statements after it. And continues with next iteration. 0 0 replyShare Please log in or register to add a comment.