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 ...
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 ...
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")
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 ...
A height of 5 should look like this:
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, ...