area of rhombus in java

Solutions on MaxInterview for area of rhombus in java by the best coders in the world

showing results for - "area of rhombus in java"
Philipp
29 Jun 2018
1import java.util.Scanner;
2public class AreaOfRhombus
3{
4   public static void main(String[] args)
5   {
6      Scanner sc = new Scanner(System.in);
7      System.out.println("Please enter length of diagonal 1: ");
8      double diagonal1 = sc.nextDouble();
9      System.out.println("Please enter length of diagonal 2: ");
10      double diagonal2 = sc.nextDouble();
11      double area = (diagonal1 * diagonal2) / 2;
12      System.out.println("Area of Rhombus is: " + area);
13      sc.close();
14   }
15}