Ok so this is my code:

#include <cs50.h>
#include <stdio.h>
int main(void)
int n;
   n = get_int("Height: ");
} while (n <= 0 || n > 23);

for (int i = 0; i <= n; i++)
   for (int j = 0; j < n + 1; j++)
       if (i + j >= n)
       printf(" ");

And when I sumbit it I get this: enter image description here

I don't get it?? I double checked my code and there doesn't seem to be an extra space. Please help! Thanks!

1 Answer 1


The errors are self explanatory.

The code accepts 0 as a valid input, it should reject it.

In all the pyramids that the code prints, the first line has two #'s. There should be only one.

Is it possible that you're working with last year's pset website? It changed this year.

If this answers your question, please click on the check mark to accept. Let's keep up on forum mainteannce. ;-)

You must log in to answer this question.

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