Jul 13, 2020

Continue statement in C

continue statement skips some lines of code inside the loop and continues with the next iteration. 
When the continue statement is encountered in a loop, all the statements after the continue statement  are skiped and the loop continues with the next iteration.
It is mainly used for a code which we want to skip.


Syntax:




Example program of continue statement:

#include<stdio.h>
void main()
{
int i;

for(i=1;i<=10;i++)
{
    if(i==5)
    {
    continue;
    }
    else
    {
    printf("%d ",i);
    }
}

}


This program will skip the 5 and print the all other values of i.

Above program shows the following output:



Share This:    Facebook Twitter

0 comments:

Post a Comment

If you have any doubts, please discuss here...