Read OnLine Cpp Program Example



4 - LOOP CONCEPT
PRAC 1 PARC 2
//wap to print 1 To 4
#include<iostream.h>
#include<conio.h>
void main()
{
int i;
clrscr();
for (i=1;i<=10;i++)
{
if (i==5)
{
break;
}
cout<<"\n"<<i;
}
getch();
}
------output------
1
2
3
4
//wap to print 1 to 10 & continue from 5
#include<iostream.h>
#include<conio.h>
void main()
{
int i;
clrscr();
for (i=1;i<=10;i++)
{
if (i==5)
{
continue;
}
cout<<"\n"<<i;
}
getch();
}
-------output------
1
2
3
4
6
7
8
9
10
Previous Next
Download Download