Continue Statement in C

The continue statement in c program helps in continuing the loop when an unexpected condition occurs, it passes the control to the starting of the loop.





The syntax of continue statement in c program is as follows:

continue;

The example of continue statement in c program is as follows:

#include <stdio.h>
 int main(){
 int i=1;
 // starting a loop from 1 to 10
 for(i=1; i<=10; i++){
 if(i==5)

{ // if value of i is equal to 5, it will continue the loop
 continue;
 }
 printf("%d\n", i);
 } // end of for loop
 return 0;
 }

Result:
1
2
3
4
6
7
8
9
10

Note: As you can notice 5 is not printed on the result as the loop is continued at i=5.


Coding Tag

Coding Tag always happy to serve you in Information Technology (IT). Learn HTML, CSS, Javascript, PHP, Android, Digital Marketing, Latest IT News and many more.

Leave a Reply

avatar
  Subscribe  
Notify of