Find Area of Parallelogram Program in C++

Google Advertisements

Prev Tutorial Next Tutorial

C++ Program to Find Area of Parallelogram

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

To calculate the area of parallelogram we need length of Base and Height. We can choose any side of a parallelogram as base to calculate area of parallelogram. Height of a parallelogram is the perpendicular distance between the base and it's opposite side.

find area of parallelogram

Formula

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

#include<iostream.h>
#include<conio.h>

void main()
{
  float base, height, area;
  clrscr();
  cout<<"Enter Base and Height of Parallelogram: ";
  cin>>base>>height;
     
  // Area of parallelogram = base X height 
  area = base * height;
  cout<<"Area of parallelogram: "<<area;      
getch();
}

Output

Enter Base and Height of Parallelogram: 20 10
Area of parallelogram: 200
c++ program to find area of parallelogram

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.

Formula

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

#include<iostream.h>
#include<conio.h>

void main()
{
 float side1, side2, perimeter;
 clrscr();
   cout<<"Enter Length of Adjacent sides of Parallelogram: ";
   cin>>side1>>side2;
   // Perimeter of parallelogram = 2X(side1 + side2)
   perimeter = 2*(side1 + side2);
   cout<<"Perimeter of parallelogram: "<<perimeter;
     
getch();
}

Output

Enter Length of Adjacent sides of Parallelogram: 5 4 
Perimeter of parallelogram: 18
c++ program to find perimeter of parallelogram
Prev Tutorial Next Tutorial

Google Advertisements

We have more than 5 Groups which have 500000+ Members and some Pages have more than 100000+ members. If you want to post your article on our website/FB Group/FB Page please contact on [email protected] or 8076671483

Buy This Ad Space @$50 per Month, Ad Size 600X200 Contact on: [email protected] or 8076671483

Path variable is set for providing path for all Java tools like java, javac, javap, javah, jar, appletviewer which are used in java programming. All these tools are available in bin folders so we set path upto bin folders.

Classpath variable is set for providing a path for predefined Java classes which is used in our application. All classes are available in lib/rt.jar so we set classpath upto lib/rt.jar.

Cloud computing is the on demand availability of computer system resources, especially data storage and computing power, without direct active management by the user.

College Projects Related to Java, AWT, C Projects for College, C++ Projects for College, Android Projects.

Download Projects

Adsense Advertisements


Buy This ads Space 8076671483

Buy This Ad Space @$120 per Month, Ad Size 300X600 Contact on: [email protected] or 8076671483 Try this Keyword C++ Programs