Accenture Interview Question

Programming Logic for star pattern