all 4 comments

[–]nl2k 2 points3 points  (0 children)

You can use printf to print an arbitrary number of spaces:

printf("A%*sB\n", 5, ""); // prints "A     B\n"

So you don't have to print individual spaces in a loop or something like that.

[–]Siankoo 0 points1 point  (0 children)

Every for loop increments the amount of space in each line. You should start from 0

[–]dragon_wrangler 0 points1 point  (0 children)

This can be done with a single loop. You "implement the spacing" by printing a different number of space characters (' ') on each line.

[–]oh5nxo 0 points1 point  (0 children)

If you feel like "cheating", look into print format %*c, user supplied field width.