Skip to content
Related Articles

Related Articles

ISRO | ISRO CS 2011 | Question 63
  • Last Updated : 11 May, 2018

What is the output of the following C code?

#include 
int main()
{
int index;
for(index=1; index<=5; index++)
{
printf("%d", index);
if (index==3)
continue;
}
}

(A) 1245
(B) 12345
(C) 12245
(D) 12354


Answer: (B)

Explanation: The continue statement forces the loop to continue or execute the next iteration. When the continue statement is executed in the loop, the code inside the loop following the continue statement will be skipped and next iteration of the loop will begin.

In this code, continue statement do not contain any loop or statement so basically there would be no effect on the execution of the program.
So, the code will print 12345.

Option (B) is correct.

Quiz of this Question

Attention reader! Don't stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :