Tech Mahindra Interview Question

How to write code to draw patterns in C language.