Continue Statement

When we want to take the control to the beginning of the loop, bypassing the statement inside the loop, statement not yet executed, the keyword continue allows us to do this.

 

     Example of Continue Statement :-

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
for(a=1; a<=3;a++)
{
for(b=1;b<=3; b++)
{
if(a==b)
continue;
printf(” The value of a and b is%d %d\n”,a,b);
}
}
getch();
}

Result :-

C Language Continue Statement

 

  Result of C Language Continue Statement:-

 

#include<stdio.h>
#include<conio.h>
void main()
{
int a;
clrscr();
for(a=1; a<=10;a++)
{

if(a==5) {
continue;
}
printf("%d\n",a);

}
getch();
}

 

Result :-

C Language continue Statement

In the above code when the condition match , it will enter in that block and skip 5th step do to continue statement.

 




Follow Us

Contact Us

tutorialworldin@yahoo.com

Back to Top