I understand why it does because I am getting the input and subtracting from that.
My question is do I always have to print the spaces first before the hashes?
And can I do it without using a if statement but just for loops?
CS50 Stack Exchange is a question and answer site for students of Harvard University's CS50. It only takes a minute to sign up.Sign up to join this community
Yes, you always have to print the spaces first (well, except for height=1) because check50 looks for EXACT outputs. A missing or extra space, line feed, or anything else will cause check50 to reject it.
And yes, you can do it with just for loops. I did it without any if statements in the entire program.
If this answers your question, please accept this answer to remove the question from the unanswered question pool. Let's keep up on forum housekeeping. ;-)