How to find area and perimeter of a parallelogram – C++ Program to Find Area and Perimeter of Parallelogram

How to find area and perimeter of a parallelogram: In the previous article, we have discussed C++ Program to Find Area and Circumference of a Circle. In this article, we will see C++ Program to Find Area and Perimeter of Parallelogram.

C++ Program to Find Area and Perimeter of Parallelogram

Find perimeter of parallelogram: In this C++ program, we will calculate perimeter and area of parallelogram. Before jumping to C++ program, let’s first discuss about parallelogram and it’s properties.

A parallelogram is quadrilaterals(having four sides) with opposite sides parallel and equal in length. Opposite angles of a parallelogram are also equal.
Properties of Parallelogram

  • Opposite angles of a parallelogram are equal.
  • Diagonals of a parallelogram divides each other in two equal half.
  • Opposite sides of a parallelogram are parallel and equal in length.
  • The sum of any two adjacent angles of a parallelogram are 180 degrees.

C++ Program to Find Area of Parallelogram

How to find perimeter of a parallelogram: 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
How to calculate the perimeter of a 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.

C++ Program to Find Area of Parallelogram
C++ Program to Find Area of Parallelogram

// C++ Program to calculate area of Parallelogram
 
#include <iostream>
using namespace std;
  
int main(){
    float base, height, area;
    cout << "Enter the base and height parallelogram\n";
    cin >> base >> height;
     
    // Area of parallelogram = base X height 
    area = base * height;
    cout << "Area of parallelogram : " << area;
      
    return 0;
}

Output

Enter the base and height parallelogram
8 5
Area of parallelogram : 40

C++ Program to find 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

Perimeter of Parallelogram = 2X(S1 + S2)
Where, S1 and S2 are length of adjacent sides of parallelogram.
C++ Program to find Perimeter of parallelogram

// C++ Program to calculate perimeter of Parallelogram
 
#include <iostream>
using namespace std;
  
int main(){
   float side1, side2, perimeter;
   cout << "Enter the length of adjacent sides of parallelogram\n";
   cin >> side1 >> side2;
   // Perimeter of parallelogram = 2X(side1 + side2)
   perimeter = 2*(side1 + side2);
   cout << "Perimeter of parallelogram : " << perimeter;
 
   return 0;
}

Output

Enter the length of adjacent sides of parallelogram
10 4
Perimeter of parallelogram : 28

The comprehensive list of C++ Programs Examples covered in our pages are very useful for every beginners and experienced programmers. So, make use of these C++ Coding Exercises & hold a grip on the programming language.