C++ Program to demonstrate use of continue statement [DEVCPP/GCC]


CONTINUE STATEMENT

Whenever a continue statement is encountered inside a loop, the rest of statements inside loop’s body for the current iteration are skipped and the control is transferred to the beginning of the loop for next iteration.

PROGRAM

//Program to demonstrate working of continue statement by displaying integers from 1 to 10 except 7   and 9

#include<iostream>

using namespace std;

int main()
{
for( int i=1 ; i<=10 ; i++ )
{
if(i==7 || i==9)
{
continue;
}
cout<<i<<" ";
}
return 0;
}

OUTPUT

C++ Program to demonstrate use of continue statement


Share this

Related Posts

FIND US ON FACEBOOK!