0
How can i print the exact multiplication table line by line
How can i print the exact multiplication table line by line eg:- 1*2=2 2*2=4 not using variables eg:- I*j= 2 I*j= 4
3 Antworten
+ 5
You could use two for-loops, and multiply them together. At the end of the first row, skip another line.
+ 2
#include <iostream>
using namespace std;
int main()
{
int n;
cout << "Enter number: ";
cin >> n;
//change 10 to whatever you want, or even introduce a new variable so the user can select
for (int i = 1; i <= 10; i++)
cout << n * i << "\n";
}
+ 1
Good question Akash, I'll try doing this for my next code.