I saw this question has been asked in multiple ways before but I believe I've checked answers and am still stumped as to the issue I have.
The output for my pset1 Mario more comfortable appears to be correct, with no extra spaces after the pyramid and the correct number of hashes and rows. However when checking with check50 I receive the following:
:) mario.c exists
:) mario.c compiles
:) rejects a height of -1
:) rejects a height of 0
:( handles a height of 1 correctly
expected ""# #"", not ""# #""
did you add too much trailing whitespace to the end of your pyramid?
:( handles a height of 2 correctly
expected "" # #"\n"## ...", not "" # #"\n"## ..."
did you add too much trailing whitespace to the end of your pyramid?
:( handles a height of 8 correctly
expected "" # #"\...", not "" # #"\..."
did you add too much trailing whitespace to the end of your pyramid?
:( rejects a height of 9, and then accepts a height of 2
expected "" # #"\n"## ...", not "" # #"\n"## ..."
did you add too much trailing whitespace to the end of your pyramid?
:) rejects a non-numeric height of "foo"
:) rejects a non-numeric height of ""
Here's how my pyramid looks with . instead of spaces:
.....# # ....## ## ...### ### ..#### #### .##### ##### ###### ######
Here's my code, any help much appreciated I can't see where I may have gone wrong.
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int height;
do
{
height = get_int("Height: ");
}
while (height > 8 || height < 1);
// ABOVE User inputs height between 1-8 inclusive
// BELOW Pyramid is built using 'for loops' and integers 'row', 'space', 'L' and 'R'.
for (int row = 0; row < height; row++)
{
int space;
for (space = (height - 1); space > row; space = space - 1)
{
printf(" ");
}
int L;
for (L = 0; L <= row; L++)
{
printf("#");
}
printf(" ");
int R;
for (R = 0; R <= row; R++)
{
printf("#");
}
printf("\n");
}
printf("\n");
}