for i=4, for the operation i=i+1, then the value of i will be=5. coming to next line no 18, you told than loop will start again from line no 13, then how 5 is printed. when cout<<i<<endl; is after the continue.
Break an continue
Hi @manudeep_21
int i=1;
while(i<=10){
if(i==4)
i=i+1;
continue;
}
cout<<i<<endl;
i=i+1;
}
return 0;
See in this code till 3 all number are printed. And when i==4 then control enters into if case where i becomes 5 and due to continue statement control get backs to starting of while loop with i=5 then all numbers till 10 including 5 are printed. See that 4 is not printed because of continue statement.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.