Hi,

For school I have to make some stupid triagles like:

*
**
***
****
*****

1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

1
2 3
3 4 5
4 5 6 7
5 6 7 8 9

I know I have to start with:

for(int count; count <= 5; count++)

but I just can't figure out what's next for all 3 off my triangles?

Can you help me out?

Assuming that count ranges from 1 through 5, for each iteration of your for loop, you have to print something (be it stars, numbers, etc.) out count-times. You'll probably need another for loop that goes from 1 through count in which you do the printing and add a newline after each time the inner for loop completes. Do you have any more code?

If you do a site search for "triangle" this has been gone over before.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.