A good practice of writing code, is to break down the problem into small steps.
A good practice of writing code, is to break down the problem into small steps.
Use the comment lines to first write down each step, like this:
for (int i=0; i<=height; i++)
{
// print spaces for left pyramid
// print hashes
// print gap
// print hashes for right pyramid
// print new line
}
And then fill each part with code.