A Program to Find the Area of a Parallelogram

In this example, we are giving a program to find the area of a parallelogram. The rule of finding the area of a parallelogram is: A = base * vertical_height.


Program to find the area of a parallelogram:

  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. int main() {
  5. float b, h, area;
  6. cout << "Enter the value of base and height: " << endl;
  7. cin >> b >> h;
  8. area = b * h;
  9. cout << "Area of parallelogram: " << area;
  10. return 0;
  11. }

Output:

Enter the value of base and height: 3, 4
Area of parallelogram: 12.00