Merilytics Interview Question

Given a star pattern, write code to print the same.