So I've got the program up and running, I'm just trying to understand exactly why it is performing correctly. I'm confused on this:
for (rows = 0; rows < height; rows++)
{
for (spaces = (height - rows); spaces > 1, spaces--)
{
printf(" ");
}
This gives me the effect I'm looking for, but my math says it shouldn't. When I try to reason it out in order, I end up with the "rows" variable being 1 on the first loop, therefore for a given height (lets say 4) I get:
spaces = (height(4) - rows(1)) which is 3, then decrement "spaces" by 1 and I get 2 spaces for the first line, which is the incorrect amount. However when my program runs, I end up with 3 spaces in the first line which is the correct amount. What am I missing here?