# pset1 mario less comfortable

Can someone lend me some advice? I'm having trouble with finding the logic between the space and hashes.

``````int main(void)
{
int height, row, hash;

do
{
printf("Height: ");
height = get_int();
}
while (height < 0 || height > 23);

for (row = 0; row < height; row ++)
{
for(hash = 0; hash < height + 1; hash ++)
{
printf("#");
}
printf("\n");
}
}
``````
• What have you tried? Inside your for loop, can you use the row number to determine how many spaces or hashes to print? Sep 20, 2017 at 1:50
• Updated what I have so far. Sep 20, 2017 at 3:12
• Like @robert_x44 said, the number of hashes depends on `row` (rather than `height`). The number of spaces before the hashes might depend on both `row` and `height`. Sep 20, 2017 at 7:18
• Hi Perry, the last line of a pyramid will have <i>height</i> Hashes. And the first line need one Hash, only. Therefore, you've to fill up the left side inside of the first line with <i>height-1</i> spaces. The count of space inside of the second line: <i>height-2</i>. etc. etc. Dec 21, 2017 at 7:20
• When I was working on this assignment, I used the same method as Perry, that is, use for loop to repeatedly paint "space" & "#". But I wonder if there is a simpler way. Feb 26, 2018 at 10:09