# C Program to Calculate Area and Perimeter of Parallelogram

Here is a C program to find the area and perimeter of a parallelogram. A parallelogram is quadrilaterals(having four sides) with opposite sides parallel and equal in length. Opposite angles of a parallelogram are also equal.

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

Properties of Parallelogram
• Diagonals of a parallelogram divides each other in two equal half.
• Opposite sides of a parallelogram are parallel and equal in length.
• Opposite angles of a parallelogram are equal.
• The sum of any two adjacent angles of a parallelogram are 180 degrees. To calculate the area of parallelogram we need length of Base and Height.
Base : We can choose any side of a parallelogram as base to calculate area of parallelogram.
Height : Height of a parallelogram is the perpendicular distance between the base and it's opposite side.

Area of Parallelogram
The area of a parallelogram can be calculated by multiplying Base and Height.
• Area of Parallelogram = B X H
Where,
B is the length of base of parallelogram.
H is the length of height of parallelogram.
(Base and Height are perpendicular on each other)
Perimeter of Parallelogram
The perimeter of a parallelogram can be calculated by adding the length of all four sides of parallelogram. As we know the length of opposite sides of parallelogram are equal, we can add any two adjacent sides of parallelogram and then multiply it with 2 to get perimeter of parallelogram.
• Perimeter of Parallelogram = 2X(S1 + S2)
Where,
S1 and S2 are length of adjacent sides of parallelogram.

## C program to find the area of the parallelogram

To find the area of a parallelogram we need to the length of it's Base and Height. Below program, first takes length of base and height as input from user using scanf function and stores it in floating point variable. Now, we multiple base and height of parallelogram to get it's area as per formula given above. Finally it prints the area on screen using printf function.

```#include <stdio.h>

int main(){
float base, height, area;

printf("Enter the base and height
parallelogram\n");
scanf("%f %f", &base, &height);

area = base * height;
printf("Area of parallelogram : %0.4f\n",
area);

return 0;
}
```

Output
```Enter the base and height parallelogram
5 3.5
Area of parallelogram : 17.5000
```

## C program to find perimeter of the parallelogram

To find the perimeter of a parallelogram we need to the length of adjacent sides of a parallelogram. Below program, first takes length of two sides as input from user using scanf function and stores it in floating point variable. Now, we add length of both sides of parallelogram and multiply it with 2 to get it's perimeter as per formula given above. Finally it prints the perimeter on screen using printf function.

```#include <stdio.h>

int main(){
float side1, side2, perimeter;
printf("Enter the length of adjacent sides
of parallelogram\n");
scanf("%f %f", &side1, &side2);

perimeter = 2*(side1 + side2);
printf("Perimeter of parallelogram : %0.4f\n",
perimeter);

return 0;
}
```
Output
```Enter the length of adjacent sides of parallelogram
4.0 3.0
Perimeter of parallelogram : 14.0000
```