How can i print the exact multiplication table line by line | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

4th Dec 2016, 1:03 AM
Akash
Akash - avatar
3 Answers
+ 5
You could use two for-loops, and multiply them together. At the end of the first row, skip another line.
4th Dec 2016, 1:09 AM
Keto Z
Keto Z - avatar
+ 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"; }
4th Dec 2016, 2:27 AM
Cohen Creber
Cohen Creber - avatar
+ 1
Good question Akash, I'll try doing this for my next code.
4th Dec 2016, 1:40 AM
Ash Ketchum
Ash Ketchum - avatar