Write a program that displays a multiplication table.
Ask the user for the ending number then display table.
For example:
Enter a stopping number: 3
1*1=1
1*2=2
1*3=3
2*2=4
2*3=6
3*3=9
Notice that a particular pair of numbers is displayed only once; for example, the table includes
2*3=6 but does not include 3*2=6.
Use a pair of nested 'for' loops to write this program.
How would I set up the two 'for' loops? I'm completely lost on this problem and have been trying for over a week to figure it out. I know it's probably relatively simple, but I don't have a large coding background and am really in need of help with this.
Since multiplication is transitive, it's very simple. If the second number is less than the first number, we would already have displayed it. Before you stick in an if statement, consider the following:
for (int j = i ; j <= stopping_number ; j++) // inner loop starts at i, not 1
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
I'll give that a go, and also thank you for the tip! Didn't mean to make it a hassle looking through my code, in the future I'll definitely use those code tags.