I'm stuck on the Mario part of PSet1. I've managed to write up my program and the output is always correct (or at least seems to be to me). I know it's definitely the loops that are making things difficult for me. Here are my loops:
for (int i = 0; i < n; i++)
{
for (int a = 0; a < (n - (i+1)); a++)
{
printf(" ");
}
for (int b = 0; b <= (i + 1); b++)
{
printf("#");
}
printf("\n");
}
The output looks exactly the same as it should. However, when I execute Check50, I get the following:
:) mario.c exists
:) mario.c compiles
:) rejects a height of -1
:) handles a height of 0 correctly
:( handles a height of 1 correctly
\ expected output, but not "##\n"
:( handles a height of 2 correctly
\ expected output, but not " ##\n###\n"
:( handles a height of 23 correctly
\ expected output, but not " ##\n ..."
:) rejects a height of 24
:) rejects a non-numeric height of "foo"
:) rejects a non-numeric height of ""
I'd really appreciate some help! Thanks!