Area = 0.5(product of diagonals)
Enter the length of diagonals as input. Now we calculate the area by using the given formula and get the desired output.
Here is the source code of the Java Program to Find the Area of Rhombus. The Java program is successfully compiled and run on a Windows system. The program output is also shown below.
public class Rhombus_Area
public static void main(String args)
int a, b;
Scanner s = new Scanner(System.in);
System.out.print("Enter the length of first diagonal:");
a = s.nextInt();
System.out.print("Enter the length of second diagonal:");
b = s.nextInt();
area = 0.5 * (a * b);
System.out.println("Area of rhombus:"+area);
$ javac Rhombus_Area.java $ java Rhombus_Area Enter the length of first diagonal:4 Enter the length of second diagonal:5 Area of rhombus:10.0
Sanfoundry Global Education & Learning Series – 1000 Java Programs.