Continue Statement in C by R4R Team

When we using continue statement in loops then it break the execution and start the loop with current value of variable.

Syntax-
loop(condition)
{
continue;
}


program-

#include < stdio.h>
int main()
{
int i;
for(i=0;i< 10;i++) {
if(i< 7)
continue;
printf("i=%dn",i);
}
}


output-

i=7
i=8
i=9

-In this program, we run the loop from i=0 to i=9
-But we apply condition that if(i< 9) continue, that means for i=0,1,2,3,4,5,6 continue statement execute and loop start again so that print() statement is not execute for such value of i.
-Then for i=7,8,9 continue statement is not run that's by printf() statement execute so output is i=7,i=8,i=9.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!