Continue Statement in C++
Continue is also a loop control statement just like the break statement. continue statement is opposite to that of break statement, instead of terminating the loop, it forces to execute the next iteration of the loop.
As the name suggest the continue statement forces the loop to continue or execute the next iteration.
As the name suggest the continue statement forces the loop to continue or execute the next iteration.
Syntax:
continue;
Example of continue statement:-
#include<iostream>
using namespace std;
int main()
{
int sum=0;
for (int i = 1; i <= 10; ++i)
{
if ( i == 6 || i == 9)
{
continue;
}
sum += i;
}
cout <<"sum = "<<sum;
return 0;
}
0 Comments
कमेंट केवल पोस्ट से रिलेटेड करें