Here is a C program to find the area and perimeter of a rectangle. The rectangle is quadrilaterals(having four sides). All four interior angles of a rectangle are 90^{.}(right angles).

The **area of a rectangle** is the amount of two-dimensional space inside the boundary on rectangle. The area of a rectangle can be calculated by placing the rectangle over a grid and counting the number of square units it takes to completely fill a rectangle.

The perimeter of a rectangle is the linear distance around the boundary of the rectangle.

In other words, we can think of perimeter of a rectangular surface as the length of fence needed to enclose that rectangular surface, area is the space inside surface.
Perimeter is measured in linear units like meter, centimeter, mile etc, whereas area is measured in square units like cm^{2}, Km^{2} etc.

**Area of Rectangle**

To find the area of rectangle we multiply it's Length and Width.

**Area of Rectangle = L X W**

L is the length of longer side of rectangle

W is the length of smaller side of rectangle

**Perimeter of Rectangle**

To find the perimeter of a rectangle, we should add the length of all four sides of rectangle. As opposite sides of a rectangle are equal we can calculate perimeter of rectangle as follows:

**Perimeter of Rectangle = 2 X (L + W)**

L is the length of longer side of rectangle

W is the length of smaller side of rectangle

## C Program to find the area of the rectangle

To calculate area of a rectangle, we need length and width of a rectangle. Below program, first takes length and width as input from user using scanf function and stores in 'length' and 'width' variables. To find the area of rectangle we multiple the length and width of rectangle and store area in a floating point variable. At last, it prints the area of rectangle on screen using printf function.

#include <stdio.h> int main(){ float length, width, area; printf("Enter length of Rectangle\n"); scanf("%f", &length); printf("Enter width of Rectangle\n"); scanf("%f", &width); /* Area of Rectangle = Length X Width */ area = length * width; printf("Area of Rectangle : %0.4f\n", area); return 0; }

**Program Output**

Enter length of Rectangle 6.5 Enter width of Rectangle 5 Area of Rectangle : 32.5000

## C Program to find the perimeter of the rectangle

Below program, first takes length and width as input from user using scanf function and stores in 'length' and 'width' variables. To find the perimeter of rectangle we add the length and width of rectangle and then multiply it with 2(as per formula given above) and store perimeter in a floating point variable. At last, it prints the perimeter of rectangle on screen using printf function.

#include <stdio.h> int main(){ float length, width, perimeter; printf("Enter length of Rectangle\n"); scanf("%f", &length); printf("Enter width of Rectangle\n"); scanf("%f", &width); /* Perimeter of Rectangle = 2 X(Length + Width) */ perimeter = 2*(length + width); printf("Perimeter of Rectangle : %0.4f\n", perimeter); return 0; }

**Program Output**

Enter length of Rectangle 6.5 Enter width of Rectangle 5 Perimeter of Rectangle : 23.0000

**Properties of Rectangle**

- Opposite sides of a rectangle are equal and parallel.
- A rectangle is a special case of parallelogram, where all internal angles are 90 degree and diagonals are equal.
- A rectangle is also a special case of trapezium, where opposite sides are parallel and equal.
- The diagonals of a rectangle bisects each other(in two equal half).
- A square is special case of rectangle where all sides are equal.

**Related Topics**