C++ Continue Statement

C++ continue statement provides a way to instantly jump to the beginning of the loop for the next iteration. After continue statement, the control is immediately shifted to the beginning of the loop by ignoring followed statements. 

It is mostly used within for, while, do-while loops or switch statements.

Syntax: continue statement:

Continue;

Flow Chart: Continue Statement

Example: C++ continue Statement

//continue statement in C++
#include <iostream>  
using namespace std;  
int main()  
{  
    for (int i = 1; i <= 10; i++) {
        if (i == 5) {
            continue;
        }
        cout << i << endl;
    }

return 0;
} 

Output

1
2
3
4
6
7
8
9
10

Recommended Articles

C++ program to calculate average and percentage

C++ program to find the area and perimeter of a rectangle

Scroll to Top