# How should I start this problem?

• October 2nd, 2013, 11:37 PM
Dieuhballic
How should I start this problem?
Write a program that accepts an integer "n" and prints the following picture of a diamond with 2n-1 rows

Number #3:

Attachment 2343

I really need help with this i have no idea where to start.
• October 3rd, 2013, 12:17 AM
Junky
Re: How should I start this problem?
Don't worry about the whole problem, just work on smaller parts and build upon. Can you write code to produce:
Code :

``` X XXX XXXXX```
If so then you are half way there. All you need to do after that is to repeat the pattern but upside down. Depending upon how you wrote the program you might end up with 2 middle lines. If so then work out how to eliminate one.
• October 3rd, 2013, 12:51 PM
Dieuhballic
Re: How should I start this problem?
Quote:

Originally Posted by Junky
Don't worry about the whole problem, just work on smaller parts and build upon. Can you write code to produce:
Code :

``` X XXX XXXXX```
If so then you are half way there. All you need to do after that is to repeat the pattern but upside down. Depending upon how you wrote the program you might end up with 2 middle lines. If so then work out how to eliminate one.

This is the only part I don't know how to do could you please explain some of it please.
• October 4th, 2013, 12:05 AM
Junky
Re: How should I start this problem?
Start with a piece of paper (graph paper would work well). Write down the all the X's for 3 or 4 lines. Then count how many X's and how many spaces are on each line. Do you see a pattern?