My mario project prints exactly what is supposed to but cs50 is not passing it, for numbers 2,and above and when i look at the link for the bug their output is exactly same as mine. Did someone run to the same problem. here is my code snippet below:

int main(void)
int usernum;

// making sure user input a number between 1 to 23 
    printf("Height: ");
    usernum = GetInt();
   }while(usernum > 23 || usernum < 0);

   for(int column = 0,space = usernum; space >= 0 || 
        column <= usernum; column++,space--)
    for(int row = 0; row < space ; row++)
        // checking to see if we have reached the end of space
        if(row + 1 == space)
           // if yes then start printing the hashes :).
           for(int row = 0; row <= column + 1; row++)

        printf(" ");
    // making sure to print one less next line then user's input
     if(column < usernum)

return 0;

1 Answer 1


Actually, it doesn't print exactly what was asked for. It's just really hard to see the problem. Try printing an 'x' where you are printing spaces and you'll immediately see the problem. As for how to fix it, well, that's for you to do. ;-)

CHECK50 looks for very exact output. If there are any extra or missing prompts, spaces, line feeds or anything else, it will fail. This is the only way that they can handle grading for tens of thousands of people enrolled in the class and doing different psets all year long!

If this answers your question, please click on the check mark to accept the answer. Let's keep up on forum housekeeping. ;-)

  • Hmmm... someone didn't like my answer but left no comment why. Remember, this is a teaching environment. My answer is stated as it is because its better to lead someone to find the answer on their own than to just give it to them!
    – Cliff B
    Jun 20, 2017 at 19:15

You must log in to answer this question.

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