area and perimeter of trapezium in java

Solutions on MaxInterview for area and perimeter of trapezium in java by the best coders in the world

showing results for - "area and perimeter of trapezium in java"
Jaret
30 Mar 2020
1import java.util.*;
2public class AreaAndPerimeterOfTrapezium
3{
4   public static void main(String[] args)
5   {
6      float a = 6;
7      float b = 14;
8      float c = 10;
9      float d = 5;
10      float h = 21;
11      float area = (float) (0.5 * (a + b) * h);
12      // a, b, c and d are sides of trapezium
13      float perimeter = a + b + c + d;
14      System.out.println("area of trapezium is: " + area);
15      System.out.println("perimeter of trapezium is: " + perimeter);
16   }
17}