What is the output of the following C program? # include
What is the output of the following C program?
# include
int main ( )
{
int index;
for (index = 1; index < = 5; index ++)
{
printf ("%d", index);
if (index = = 3)
continue;
}
}
Show answerHide answer
Correct answer: (B) 12345
Explanation
printf runs before the if statement, so continue only skips the (empty) rest of the loop body. Every value from 1 to 5 is printed: 12345.