edited by
5,464 views
5 votes
5 votes

What is the output of the following C code?

#include <stdio.h>

int main()
{
    int index;
    for(index=1; index<=5; index++)
    {
        printf("%d", index);
        if (index==3)
            continue;
    }
}
  1. 1245
  2. 12345
  3. 12245
  4. 12354
edited by

2 Answers

Best answer
10 votes
10 votes

B)12345

Here continue is last line . So,it will not skip any number

selected by
6 votes
6 votes

ans is (b)

The continue statement in C programming works somewhat like thebreak statement. Instead of forcing termination, it forces the next iteration of the loop to take place, skipping any code in between.

edited by
Answer:

Related questions

15 votes
15 votes
1 answer
1
0 votes
0 votes
1 answer
2
TusharKumar asked Dec 22, 2022
509 views
can anyone explain how the for loop works here..?