Break and Continue in C++

Learn the use of break and continue statement using this c++ program.

#include<iostream>
#include<conio.h>
using namespace std;

int main()
{
int i;
for(i=1;i<=10;i++)
{
if(i==4)
{         
    // 4 number is skipped.
continue;
}
if(i==9)
{
// loop breaks and control goes out of for loop
break;
}
cout<<i<<"\n";
}
return 0;
}


Output

1
2
3
5
6
7
8

Comments

Popular posts from this blog

File handling

Getting started with android app development

How to create android Text To Speech app