If I run your code, and enter the same value as you, what I get is the right numbers:
Please enter a number:
5
| 1 2 3 4 5
-------------------------
1| 1 2 3 4 5
2| 4 6 8 10
3| 9 12 15
4| 16 20
5| 25
All that is wrong is the formatting - and that's because you don't allow for "empty columns" in a row before your value output.
I'd have a row number that went from 0 to N - 1, and for each row I'd prefix that number of blank columns before I started outputting actual data.
Think about how you would do it manually, and you'll see what I mean.