Write a program that calculates and displays the area of a parallelogram.

###### Solution

The area of a parallelogram can be calculated using the following formula:

Area = Base × Height

In this exercise, the user enters values for Base and Height and the script calculates and displays the area of the parallelogram. The solution to this problem is shown here.

## PHP

```<?php
echo "Enter the length of Base: ";
\$base = trim(fgets(STDIN));
echo "Enter the length of Height: ";
\$height = trim(fgets(STDIN));

\$area = \$base * \$height;

echo "The area of the parallelogram is ", \$area;
?>
```

## Java

```public static void main(String[] args) throws java.io.IOException {
java.io.BufferedReader cin = new java.io.
BufferedReader(new java.io.InputStreamReader(System.in));
double area, base, height;

System.out.print("Enter the length of Base: ");
base = Double.parseDouble(cin.readLine());
System.out.print("Enter the length of Height: ");
height = Double.parseDouble(cin.readLine());

area = base * height;

System.out.println("The area of the parallelogram is " + area);
}
```

## C++

```#include <iostream>
using namespace std;
int main() {
double area, base, height;

cout << "Enter the length of Base: ";
cin >> base;
cout << "Enter the length of Height: ";
cin >> height;

area = base * height;

cout << "The area of the parallelogram is " << area;
return 0;
}
```

## C#

```static void Main() {
double area, base_parallelogram, height_parallelogram;

Console.Write("Enter the length of Base: ");
base_parallelogram = Double.Parse(Console.ReadLine());
Console.Write("Enter the length of Height: ");
height_parallelogram = Double.Parse(Console.ReadLine());

area = base_parallelogram * height_parallelogram;

Console.Write("The area of the parallelogram is " + area);
Console.ReadKey();
}
```

## Visual Basic

```Sub Main()
Dim area, base_parallelogram, height_parallelogram As Double

Console.Write("Enter the length of Base: ")
base_parallelogram = Console.ReadLine()
Console.Write("Enter the length of Height: ")
height_parallelogram = Console.ReadLine()

area = base_parallelogram * height_parallelogram

Console.Write("The area of the parallelogram is " & area)

Console.ReadKey()
End Sub
```

## Python

```base = float(input("Enter the length of Base: "))
height = float(input("Enter the length of Height: "))

area = base * height

print("The area of the parallelogram is", area)
```