So I logically figured out everything but the hashes.
I mean it executes correctly, but why??
Why does the first line start with two hashes??? Isn't the initial value zero? It increments by one, but why is the starting point two?
Other ways that seemed like great logic to me did not work. (set initial value to 2, set it to (row + 2), ...)
I really can't wrap my head around it and it's driving me crazy.
What am I missing here?
Where is the flaw?
for (int row = 0; row < height; row++)
{
// spaces left of pyramid
for (int space = (height - 1); space > row; space--)
{
printf(" ");
}
// hashes of pyramid
for (int hash = 0; hash < (row + 2); hash++)
{
printf("#");
}
// new line after each row
printf("\n");
}