Hello coders, in this post, we will learn** Java program to calculate area and perimeter of Parallelogram**. In the previous tutorial, you have learned Java Program to calculate Area and Perimeter of Square.

We can calculate the parallelogram’s area and perimeter using the following formulas.

Area of Parallelogram= b×h

Perimeter of Parallelogram = 2(b+h)

Where,

**b**is base of the parallelogram.**h**is height of the parallelogram.

Now let’s write the program.

## Java Program to Calculate Area and Perimeter of Parallelogram

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import java.util.*; public class Parallelogram { public static void main(String[] args) { double h, b , area, perimeter; Scanner in = new Scanner(System.in); // Asking the user to enter the height and breadth of the parallelogram System.out.println(" Enter the height and breadth of the parallelogram :"); h = in.nextDouble(); b = in.nextDouble(); area = b * h; // Calculating area of parallelogram perimeter = 2*(b+h); // Calculating perimeter of parallelogram System.out.println(" Area of Parallelogram : " + area +" square units"); System.out.println("\nPerimeter of Parallelogram : " + perimeter); } } |

**What we Did?**

- First of all we have imported the util package.
- Then created a class and named it Parallelogram.
- After that started main() method of the program.
- Then inside main() method declared variables.
- Then created object of the Scanner class.
- Now asked the user to enter the height and breadth of the parallelogram. Then read the value of height and breadth of parallelogram entered by the user.
- Then calculated area of parallelogram using the formula
**area = b * h** - In the next line calculated perimeter of parallelogram using the formula
**perimeter = 2 * (b + h)** - Then finally displayed the value of area and perimeter of parallelogram on the screen.

**Output:**

1 2 3 |
Enter the height and breadth of the parallelogram :2 3 Area of Parallelogram : 6.0 square units Perimeter of Parallelogram : 10.0 |

So in this tutorial, we learned how to write ** Java program to calculate area and perimeter of Parallelogram. **In the next tutorial, you will learn Java Program to calculate Area of Trapezium.

**Related Tutorials…**

- Java Program to Calculate Area and Circumference of Circle
- Java Program to calculate Area of Triangle
- Java Program to calculate Area of Triangle using heron’s formula
- Java Program to calculate Area and Perimeter of Right Triangle
- Java Program to calculate Area and Perimeter of Rectangle
- Java Program to calculate Area and Perimeter of Square
- Java Program to calculate Area and Volume of Cube
- Java Program to calculate Area and Volume of Cuboid
- Java Program to calculate Total Surface Area and Curved Surface Area of cylinder
- Java Program to calculate Volume of Cone
- Java Program to calculate Surface Area and Volume of Sphere