Tech Mahindra interview question

How to write code to draw patterns in C language.