#include <stdio.h>
#include <cs50.h>
int main(void)
{
int n;
do
{
n = get_int("Height: ");
}
while (n<=0 || n>23);
}
-
When I ran it it worked, try compiling it again.– UnderscoreAMay 29, 2019 at 4:48
1 Answer
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.