How to Draw Rectangle using C Graphics

Draw Rectangle using C Graphics

Here you will learn and get the example code to draw rectangle in computer graphics.

A rectangle is a four-sided flat shape with straight sides, four right angles, and opposite sides of equal length. It has two pairs of parallel sides. This shape is commonly found in geometry, architecture, and everyday objects.

What is rectangle function in computer graphics?

Rectangle function in computer graphics is used to draw a rectangle on the screen. It has four parameters. The syntax to draw a  rectangle is the following:

Syntax:

rectangle(x1,y1,x2,y2);

Here x1,y1 are the top left corner of the rectangle shape and x2,y2 are the bottom right corners of the rectangle shape.

Program code to Draw Rectangle


Output

draw rectangle in c graphics

 

 

 

 

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top