Making a multiplication chart/table

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.
Update!

I have finally at least gotten this to work;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//CSC150 Lab6
//Ian Heinze
//10/2/2015


#include <iostream>
using namespace std;
int main()
{
    int stopping_number;

    cout << "Enter the stopping number: ";
    cin >> stopping_number;

    for (int i = 1 ; i <= stopping_number ; i++)
    {
        cout << endl;
        for (int j = 1 ; j <= stopping_number ; j++)
        cout << i << "X" << j<< "="<< (i * j) << endl;
    }

    return 0;
}



Now how would I only get it to not show repeated numbers?
Last edited on
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.

Again, thank you!
Topic archived. No new replies allowed.