0

I am having a heck of a time trying to fix my error of "did you add too much trailing whitespace to the end of your pyramid?". It looks identical to me, but obviously I am missing something. Any help would be so appreciated!

    // int height = get_int("How tall do you want your pyramid? Give me a number between 1-10\n");
    // int width = get_int("How wide do you want your pyramid? Give me a number between 1-10\n");
    int height;
    // int width;
    do {
        height = get_int("How tall do you want your pyramid? Give me a number between 1-8\n");
        // width = get_int("How wide do you want your pyramid? Give me a number between 1-10\n");
    }
    while (height < 1 || height > 8);
        int counter = 0;
        for (int i = 1; i <= height; i++){
            printf("\n");
            for (int c = (height - i) - counter; c > 0; c--){
                    printf(" ");
                }
            for (int j = 1; j < (i + 1); j++){
                printf("#");
            }
        } 
   

}

ERROR: :( handles a height of 1 correctly expected ""#"", not ""#"" did you add too much trailing whitespace to the end of your pyramid?

1 Answer 1

1

Why are you printing a newline before your pyramid?

Remember the spec showed:

~/pset1/mario $ ./mario
Height: 4
   #
  ##
 ###
####

check50 will be looking for that.

1
  • It seems like when I move the newline, the #'s show up on the same line...but I'll play around with it, thank you!
    – Ash
    Jul 30, 2020 at 17:12

You must log in to answer this question.

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