How to solve any Star Pattern Program

How to solve any Star Pattern Program