area of rhombus in java code example
Example: area of rhombus in java
import java.util.Scanner;
public class AreaOfRhombus
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("Please enter length of diagonal 1: ");
double diagonal1 = sc.nextDouble();
System.out.println("Please enter length of diagonal 2: ");
double diagonal2 = sc.nextDouble();
double area = (diagonal1 * diagonal2) / 2;
System.out.println("Area of Rhombus is: " + area);
sc.close();
}
}