C program to draw Rectangle shapes using ASCII characters

Hi Viewers, I am going to write a simple C program to draw a Rectangle shape based on user input. I am going to use the ASCII characters to print the Rectangle.

Let’s see the code:

In the above program, the drawRectangle function takes the width and height of the rectangle as parameters. It uses nested loops to iterate through each row and column of the rectangle and prints either an asterisk (*) for the boundary or a space for the interior.

In the main function, the user is prompted to enter the width and height of the rectangle, which are then passed to the drawRectangle function. The function is called with the provided dimensions, and the rectangle is drawn on the console.


This C program is beneficial for College / School kids to learn the C language. I hope this helped you the same.

Related Posts

Leave a Reply