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

int main(void)
{
    int n;
    do
    {
        n = get_int("Height: ");
    }
    while (n<=0 || n>23);
}
1
  • When I ran it it worked, try compiling it again. – Mayonnaise2124 May 29 '19 at 4:48
0

23 is a valid input, as is 0. In both cases (and any in between), you should not repeat input but print a half-pyramid of n lines.

So the only problem I see is with n<=0, which rejects valid height 0, should be n < 0.

And of course you're lacking the output code, but you're probably aware of that one.

You must log in to answer this question.

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