Read OnLine Cpp Program Example



4 - LOOP CONCEPT
PRAC 5 PARC 6
//wap to print table number
#include<iostream.h>
#include<conio.h>
void main()
{
int i,n;
clrscr();
cout<<"Enter table number:";
cin>>n;
i=1;
while (i<=10)
{
cout<<"\n"<<i*n;
i++;
}
getch();
}
----output------
Enter table number:2
2
4
6
8
10
12
14
16
18
20
//wap to print table number
#include<iostream.h>
#include<conio.h>
void main()
{
int i,n;
clrscr();
cout<<"Enter table number:";
cin>>n;
i=10;
while (i>=1)
{
cout<<"\n"<<i*n;
i--;
}
getch();
}
------output-------
Enter table number:2
2
4
6
8
10
12
14
16
18
20
Previous Next
Download Download