For loop and continue statement in c/c++

void main()
{
for(i=1;i<5;i++)
{
if(i==3)
Continue;
else
printf(“%d”,i);
}
}
Tutorial answer:
1 2 4
Debugging solution
When the for loop reach i=3 in that time if condition is true so it will execute continue statement it will not go to else statement, then it will print 4 finally I become 5 then for loop condition become false because 5 is not greater than i
They are equal so it will terminate for loop condition

Post a Comment

0 Comments