Read OnLine Cpp Program Example



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