so I thought I had finally completed Pset1 and went back to mario to do the check50, and well it doesn't seem to like my code, and I can't see where I am going wrong, another pair of eyes would be greatly appreciated.
Here is the code:
#include <stdio.h>
#include <cs50.h>
int main(void)
// prompt user for height of half-pyramid
{
int height;
do
{
printf ("height: ");
height = GetInt();
}
while ((height < 0) || (height > 23));
// print the half-pyramid
int row, space, hash;
for (row = 0; row < height; row++)
{
for (space = height - 1; space >= row; space--)
{
printf (" ");
}
{
for (hash = -1; hash <= row; hash++)
{
printf ("#");
}
printf("\n");
}
}
}
And here is check50s response:
:) 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, and then accepts a height of 2
\ expected output, but not " ##\n ###\n"
:) rejects a non-numeric height of "foo"
:) rejects a non-numeric height of ""
Thank you