C++ program that uses a while structure and the tab escape sequence
Object:
Write a C++ program that uses a while structure and the tab escape sequence \ t to print the following table of values:
Code:
#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
int num=1;
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++;
}
getch();
}
#include<iostream> #include<conio.h> using namespace std; void main() { int num=1; 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++; } getch(); }
Output:
Pingback: C++ projects for beginners with source code - Codeboks
Pingback: Top 40 projects with C++ for beginners in 2021
Thanks for this marvelous post, I am glad I found this site on yahoo.