I think I have a problem with the syntax of my main loop that counts the number of lines to output. When I set the counter = 1
, it prints the correct number of rows but starts at the top with only 1 hash. And according to the directions, the top row of the pyramid should be 2.
So, then when I increase my main loop counter to 2, it starts the top row correctly as 2, but then wont print the final bottom row. So, for example if I enter 8, it gives me 7 rows, starting with the two hashes on top.
So, I think it just needs to go through one more counting loop, in which it repeats the embedded hash and space loops one last time to print my final bottom row, but I cant figure out what to adjust. Here is my code for the counting loop:
for(counter = 1; counter <= height; counter++)
so, to recap, if counter = 1
, I get right number of rows but top row is only 1 hash. If I adjust counter = 2
, I get 2 top hashes but short one row.