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 encounters in a loop, then program will skip the all the statements after the continue statement and the loop continues with the next iteration.
It is mainly used for a code which we want to skip.


  Syntax of Continue Statement in C :





  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:

Learn What is Continue Statement in C and how it works

No comments:

Post a Comment

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