Ok so lets 'draw' one by hand and then figure out how to get the computer to do what we did.
(I'm going to use '.' instead of ' ' so you can see them.)
Ok so in my head, I start with the base of the triange as that determines how big it will be:
Then I just add the lines above it:
Is that what you wanted?
So, for a 4 row triangle, the first row must be indented 3 spaces, the next 2 spaces, the next 1 space and the last line isn't indented at all.
The first line has 1 star, the second 2 stars seperated by a space, the third 3 stars with spaces and the last 4 stars with spaces.
Do you see a pattern here that you might be able to exploit?