Open In App

ISRO | ISRO CS 2011 | Question 63

Like Article
Like
Save
Share
Report

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


Last Updated : 11 May, 2018
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads