C++ simple program which uses while loop to print a multiplication table in a proper format. User inputs a number for table then limit.
program has tested on code blocks c++ compiler.
program has tested on code blocks c++ compiler.
source code:
#include<iostream> #include<conio.h> #include<iomanip> using namespace std; int main() { int n,c=1,limit; cout<<"Enter number to print its table="; cin>>n; cout<<"Enter limit="; cin>>limit; while(c<=limit) { cout<<n<<" * "<<setw(2)<<c<<" = "<<setw(2)<<n*c<<endl; c++; } getch(); }
great job sir
ReplyDelete