Number pyramid spaces

I can’t understand the loop for space. How is it printing 4 space at the beginning?

@sirprashar hey Shubham this is the dry run of an n=3 try when n=5 and I am attaching the code link of the particular problem I placed stars instead of space to identify how space is allocated in between column. please follow the link code.