in Programming in C
1,595 views
1 vote
1 vote

what is the output of the following c code?

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

a)1245

b)12345

c)12245

d)12354

in Programming in C
by
1.6k views

3 Answers

1 vote
1 vote
Output: 12345

continue statement is used to skip the statement after that
http://www.programiz.com/c-programming/c-break-continue-statement

But in above program there is not any further statement

Therefore the output will be 12345
0 votes
0 votes
it keep on printing 1 till stack overflows since every time in for loop index will be compared and it will be less than 5 so infinite loop nothing to do with i it will be keep incremented at each iteration.
0 votes
0 votes

Answer--> option (b) 12345