15,742,180 members
1.00/5 (1 vote)
See more:
How do I create a shape with an inputted character and width? (ex if I want to create a diamond using @ with 31 @symbols at the widest point?

What I have tried:

not sure how to start this program.
Posted
Updated 17-Sep-18 19:53pm

## Solution 1

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!
Start by breaking the task down: it's two halves, one to print the "increasing" chars:
```  @
@@@
@@@@@```
And one to print the "decreasing" chars:
```@@@
@
```
So start by thinking of it that way, and do each "half" separately.
Get the "top half" working first, then think about the bottom. The top is pretty easy: it's a loop to print the lines, then a loop inside that to print the characters. On teh first line, you need to print "x" spaces and "y" characters, where
`2x + y = n`
And
`y = 2l + 1`
Where `l` is the line number, zero based:
```  @    x = 2, y = 1, l = 0, n = 5
@@@   x = 1, y = 3, l = 1, n = 5
@@@@@  x = 0, y = 5, l = 2, n = 5```

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!