C++ Program To Get Multiplication Table Of Any Number
This program is to get multiplication table of any number example: if user enters 2 then the output will be the multiplication of 2 table. Multiplication table for the number entered will be multiplied till 20 (i.e) from num*1 to num*20
Algorithm:
1.Start
2.Get the input from user for the variable n (ie) a number
3.Initialize i as 1 compare whether i is lesser than or equal to 20???
4.If step-3 is true print n "*" i "=" n * i
5.If step-3 is false stop the step-6
6.Stop
Program:
# Include <iostream.h>
# Include <conio.h>
void main ()
{
clrscr ();
int n;
cout << "Enter The Value For N:";
cin >> n;
for (int i = 1; i <= 20; i + +)
{
cout << n << "*" << i << "=" << n * i << endl;
}
getch ();
}
2.Get the input from user for the variable n (ie) a number
3.Initialize i as 1 compare whether i is lesser than or equal to 20???
4.If step-3 is true print n "*" i "=" n * i
5.If step-3 is false stop the step-6
6.Stop
Program:
# Include <iostream.h>
# Include <conio.h>
void main ()
{
clrscr ();
int n;
cout << "Enter The Value For N:";
cin >> n;
for (int i = 1; i <= 20; i + +)
{
cout << n << "*" << i << "=" << n * i << endl;
}
getch ();
}
No comments