Let’s learn area and perimeter of trapezium in java.

## area and perimeter of trapezium in java

Trapezium is a quadrilateral with one pair of its sides parallel. To calculate area of trapezium formula is:

area = ½ (sum of length of parallel sides) x perpendicular distance between parallel sides

To calculate perimeter of trapezium formula is:

perimeter = a + b + c +d

where a, b, c and d are sides of trapezium. Now let’s see java program.

import java.util.*; public class AreaAndPerimeterOfTrapezium { public static void main(String[] args) { float a = 6; float b = 14; float c = 10; float d = 5; float h = 21; float area = (float) (0.5 * (a + b) * h); // a, b, c and d are sides of trapezium float perimeter = a + b + c + d; System.out.println("area of trapezium is: " + area); System.out.println("perimeter of trapezium is: " + perimeter); } }

**Output:**

area of trapezium is: 210.0

perimeter of trapezium is: 35.0

Also read – major features of java