Show us the code you have so far, and we'll help you work it out.

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." *~Joe Strummer*

sscce.org

Ultimatly this is what its suppose to look like.

Thanks to anyone that can help me.

**EDIT**by mw: Added Code Tags to keep formatting.

[ September 28, 2007: Message edited by: marc weber ]

Try describing the logic in English first. Then you will have a better idea of what you're trying to code. For example, row by row, the above triangle is...

3 spaces and 1 asterisk

2 spaces and 3 asterisks

1 space and 5 asterisks

0 spaces and 7 asterisks

If you're printing this row by row, you probably have a loop iterating each row. So it makes sense to try and relate what you're doing to the row number (a variable x).

When x is 0: 3 spaces, 1 asterisk

When x is 1: 2 spaces, 3 asterisks

When x is 2: 1 space, 5 asterisks

When x is 3: 0 spaces, 7 asterisks

So the question is: If you know x, how do you get the number of spaces and the number of asterisks?

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." *~Joe Strummer*

sscce.org

Originally posted by scott daston:

...I know the logic of it but the coding is what i need...

You know what the result should be, but do you know the logic detailed enough to code it?

For example, how can you express the number of spaces

*in terms of x?*And how can you express the number of asterisks

*in terms of x?*

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." *~Joe Strummer*

sscce.org

When x is 1: 2 spaces, 3 asterisks

When x is 2: 1 space, 5 asterisks

When x is 3: 0 spaces, 7 asterisks

Notice that the number of leading spaces is always (3 - x).

Now if you can also see how the number of asterisks relates to x, then you will have a good idea of what to code for each row.

*~Joe Strummer*

sscce.org

[DELETED]

swimdudea swimdudeb wrote:This is for people who will be searching for this same exact problem next semester for Intro to Java. I found nothing useful when browsing sites like this that explained or showed you the code. DO NOT COPY THIS CODE AS IT IS COPYRIGHT INFRINGEMENT...THIS IS MY CODE!

And there is a good reason for that. When a solution to a homework problem is posted -- people tend to not do the homework. And when people don't do homework, they don't learn.

Please help people learn. Thanks.

Henry

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan.

swimdudea swimdudeb wrote:

Please check your private messages for an important administrative matter

Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |