0
#include <cs50.h>
#include <stdio.h>

int main(void)

{
int n;
do
 {
    n = get_int ("Height: ");
 }
while (n < 1 || n > 8);
for (int i = 0; i < n; i++)
 { 
    for (int j = (i - 1); j < 6; j++)
    {
    printf(".");
    }
    printf("#\n");      
 }
}

And then it renders as this:

.......#

......#

.....#

....#

...#

..#

.#

#

0

Create another for loop for the hashes and after the end of your space and hash loop that's the only time you should print a new line.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .