Print Friendly and PDF
(Tabular Output) Write a C++ program that uses a while statement and the tab escape sequence \t to print the following table of values: N 1 0*N 1 00*N 1 000*N 1 1 0 1 00 1 000 2 20 200 2000 3 30 300 3000 4 40 400 4000 5 50 500 5000 Solution:
(Tabular Output) Write a C++ program that uses a while statement and the tab escape sequence \t to print the following table of values:

N 1 0*N 1 00*N 1 000*N
1 1 0 1 00 1 000
2 20 200 2000
3 30 300 3000
4 40 400 4000
5 50 500 5000

Solution:

#include < cstdio>
#include < cstdlib>
#include < iostream>
using namespace std;
int num = 1;
int main()
{
cout << "N\tN*10\tN*100\tN*1000\n\n";
while( num <= 5)
{
cout << num << "\t" << ( num * 10 ) << "\t" << ( num * 100 ) << "\t" << (num * 1000) << endl;
num++;
}/
/for pause
system("PAUSE") ;
return 0;

}

zubairsaif

Zubair saif

A passionate writer who loves to write on new technology and programming

Post A Comment:

0 comments: