3

Hmmm.... Good question for new programmers! The style guide is right, more than 2 or 3 nested for loops should raise red flags, especially if they are based on the same controlling variable as in the example from the image (from the style guide). The important thing here is to realize that there's a difference of asking whether it should be done vs. it ...


2

What the eye cannot detect......the check50 output will reveal. Notice the difference between what is expected and what is detected: There is an extra "space" between the final # and the \n.


1

EEK: The dreaded goto statement!! It's almost always a bad practice to use a goto statement and should be avoided whenever possible!!!! The next bad practice is encapsulating the bulk of a program in an if or else condition. When checking or validating input like this, one should always do that and only that in a localized code block. In this case, you ...


1

Your went out from you "main" loop for (int i = 0; i < x; i++) and print new line between left and right triangles. So dialog between your and machine is like: Give me a colum Print " " or "#" Transfer me to a new row Print "#" or " ". All your code should print just one row and finish this with printf("\n")


1

As per the specification the bottom-left corner of the left-hand pyramid should be left-aligned with the terminal window and therefore the number of preceding spaces should not be hard-coded.


1

There's no problem with having 5 for loops. However, there are several problems with having 5 nested for loops: It's hard to keep track when reading your code That makes it for other people to understand your code And it makes it hard for yourself to maintain your code later on In fact, those problems start as soon as you nest more than 2 levels. That's ...


1

A height of 5 should look like this: Height: 5 # # ## ## ### ### #### #### ##### ##### so this tells you that are you missing the top row. Is there a reason that your for loop has the rows starting at 2? If height is 5, then the loop will only run 4 times (when row is 2, 3, 4, 5). You need to make sure that the loop runs height times, ...


1

There should be two spaces between half-pyramids.


1

0 and 23 are valid input values. By using >0 and <23 you exclude them. Use >= and <=.


1

Per the spec, the gap between the two sides should be 2 spaces. You've got one.


Only top voted, non community-wiki answers of a minimum length are eligible