SOMEONE HELP PLEASE! NESTED LOOP

Guys, this isn't my question. This was someone's else question. I've tried to solve it but I can't solve it yet and now I just want to know the answer.

[code]
How do I show this output using for loop statement?

1
23
345
4567

Thanks in advance :)
[/code

Can somebody help me? I cannot sleep tonight if I can't figure this out. What's the solution?
closed account (D80DSL3A)
1
2
3
4
5
6
for(int i=1; i<5; ++i)
    {
        for(int j=0; j<i; ++j)
            cout << i+j;
        cout << endl;
    }


Sleep tight!
Oh, cool this works too. Thanks fun2code :). By the way, how long did it take you to figure this out?
closed account (D80DSL3A)
About 3 minutes + several more for testing the code to be sure it worked.
What other solution have you found?
That seemed easy enough, I had this same problem in my c++ class except the output was
1234
123
12
1

I couldnt figure that out for the life of me so I just gave up.
Topic archived. No new replies allowed.