Creating a half triangle using nested loops?

Can anyone help me/give me hints/tips?

the output should be something like:
5
45
543
5432
54321

i'm still a little bit confused with loops. Can anyone help me with this?
Last edited on
I hope you have a typo on line two.

Outer loop goes over the lines. On each line it executes the inner loop.

The inner loop prints as many numbers. On first line it prints one number. On second it prints two. On third ...

The numbers to print ... what if you had number 6 (no, not the http://en.wikipedia.org/wiki/The_Prisoner ) and deduct from it 1 if you should print first number, 2 if you should print second number, ...
Looks like you meant the output should be:

5
54
543
5432
54321

In which case, I would suggest that you use a string and loop from 5 to 0 appending the value of your iterator on each iteratoin and writing the content of the string variable to cout.
Topic archived. No new replies allowed.