# Java Program to Find the Area of Rhombus

• Last Updated : 03 Aug, 2022

A rhombus is a quadrilateral whose four sides all have the same length and a rhombus is also called an equilateral quadrilateral.

The formula for finding the area of a rhombus is as follows:

`(product of the lengths of the diagonals)/2 `

Example:

```Input : p = 2, q = 3
Output: 3```
```Input : p = 4, q = 5
Output: 10```

Implementation:

## Java

 `// Java Program to Find the Area of Rhombus` `public` `class` `AreaOfRhombus {` `    ``public` `static` `void` `main(String[] args)``    ``{``        ``double` `d1, d2;``        ``// Diagonal 1``        ``d1 = ``2``;``        ``// Diagonal 2``        ``d2 = ``3``;``        ``if` `(d1 <= ``0` `|| d2 <= ``0``)``            ``System.out.println(``"Length should be positive"``);``        ``else``            ``System.out.println(``"Area of rhombus = "``                               ``+ (d1 * d2) / ``2``);``    ``}``}`

Output

`Area of rhombus = 3.0`

Time complexity: O(1) since performing constant operations.

Space complexity: O(1)

My Personal Notes arrow_drop_up