# Area of circle inscribed within rhombus

Given a rhombus with diagonals **a** and **b**, which contains an inscribed circle. The task is to find the area of that circle in terms of a and b.

**Examples:**

Input: l = 5, b = 6 Output: 11.582 Input: l = 8, b = 10 Output: 30.6341

**Approach:** From the figure, we see, the radius of inscribed circle is also a height **h=OH** of the right triangle **AOB**. To find it, we use equations for triangle’s area :

Area AOB = 1/2 * (a/2) * (b/2) = ab/8 = 12ch

where **c = AB** i.e. a hypotenuse. So,

r = h = ab/4c = ab/4√(a^2/4 + b^2/4) = ab/2√(a^2+b^2)

and therefore area of the circle is

A = Π * r^2 = Π a^2 b^2 /4(a2 + b2)

**Below is the implementation of above approach:**

## C++

`// C++ Program to find the area of the circle ` `// which can be inscribed within the rhombus ` `#include <bits/stdc++.h> ` `using` `namespace` `std; ` ` ` `// Function to find the area ` `// of the inscribed circle ` `float` `circlearea(` `float` `a, ` `float` `b) ` `{ ` ` ` ` ` `// the diagonals cannot be negative ` ` ` `if` `(a < 0 || b < 0) ` ` ` `return` `-1; ` ` ` ` ` `// area of the circle ` ` ` `float` `A = (3.14 * ` `pow` `(a, 2) * ` `pow` `(b, 2)) ` ` ` `/ (4 * (` `pow` `(a, 2) + ` `pow` `(b, 2))); ` ` ` `return` `A; ` `} ` ` ` `// Driver code ` `int` `main() ` `{ ` ` ` `float` `a = 8, b = 10; ` ` ` `cout << circlearea(a, b) << endl; ` ` ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java Program to find the area of the circle ` `// which can be inscribed within the rhombus ` ` ` `public` `class` `GFG { ` ` ` ` ` `// Function to find the area ` ` ` `// of the inscribed circle ` ` ` `public` `static` `float` `circlearea(` `double` `a, ` `double` `b) ` ` ` `{ ` ` ` `// the diagonals cannot be negative ` ` ` `if` `(a < ` `0` `|| b < ` `0` `) ` ` ` `return` `-` `1` `; ` ` ` ` ` `//area of the circle ` ` ` `float` `A = (` `float` `) ((` `3.14` `* Math.pow(a, ` `2` `) * Math.pow(b, ` `2` `)) ` ` ` `/ (` `4` `* (Math.pow(a, ` `2` `) + Math.pow(b, ` `2` `)))) ; ` ` ` ` ` `return` `A ; ` ` ` `} ` ` ` ` ` `// Driver code ` ` ` `public` `static` `void` `main(String[] args) { ` ` ` `float` `a = ` `8` `, b = ` `10` `; ` ` ` ` ` `System.out.println(circlearea(a, b)); ` ` ` ` ` `} ` `// This code is contributed by ANKITRAI1 ` `} ` |

*chevron_right*

*filter_none*

## Python 3

`# Python 3 Program to find the area of the circle ` `# which can be inscribed within the rhombus ` ` ` ` ` `# Function to find the area ` `# of the inscribed circle ` `def` `circlearea(a, b): ` ` ` ` ` `# the diagonals cannot be negative ` ` ` `if` `(a < ` `0` `or` `b < ` `0` `): ` ` ` `return` `-` `1` ` ` ` ` `# area of the circle ` ` ` `A ` `=` `((` `3.14` `*` `pow` `(a, ` `2` `) ` `*` `pow` `(b, ` `2` `))` `/` ` ` `(` `4` `*` `(` `pow` `(a, ` `2` `) ` `+` `pow` `(b, ` `2` `)))) ` ` ` `return` `A ` ` ` `# Driver code ` `if` `__name__ ` `=` `=` `"__main__"` `: ` ` ` `a ` `=` `8` ` ` `b ` `=` `10` ` ` `print` `( circlearea(a, b)) ` ` ` `# This code is contributed by ChitraNayal ` |

*chevron_right*

*filter_none*

## C#

`// C# Program to find the area of the circle ` `// which can be inscribed within the rhombus ` `using` `System; ` ` ` `public` `class` `GFG { ` ` ` ` ` `// Function to find the area ` ` ` `// of the inscribed circle ` ` ` `public` `static` `float` `circlearea(` `double` `a, ` `double` `b) ` ` ` `{ ` ` ` `// the diagonals cannot be negative ` ` ` `if` `(a < 0 || b < 0) ` ` ` `return` `-1 ; ` ` ` ` ` `//area of the circle ` ` ` `float` `A = (` `float` `) ((3.14 * Math.Pow(a, 2) * Math.Pow(b, 2)) ` ` ` `/ (4 * (Math.Pow(a, 2) + Math.Pow(b, 2)))) ; ` ` ` ` ` `return` `A ; ` ` ` `} ` ` ` ` ` `// Driver code ` ` ` `public` `static` `void` `Main() { ` ` ` `float` `a = 8, b = 10 ; ` ` ` ` ` `Console.WriteLine(circlearea(a, b)); ` ` ` ` ` `} ` `// This code is contributed by inder_verma.. ` `} ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP Program to find the area ` `// of the circle which can be ` `// inscribed within the rhombus ` ` ` `// Function to find the area ` `// of the inscribed circle ` `function` `circlearea(` `$a` `, ` `$b` `) ` `{ ` ` ` ` ` `// the diagonals cannot be negative ` ` ` `if` `(` `$a` `< 0 || ` `$b` `< 0) ` ` ` `return` `-1; ` ` ` ` ` `// area of the circle ` ` ` `$A` `= (3.14 * pow(` `$a` `, 2) * pow(` `$b` `, 2)) / ` ` ` `(4 * (pow(` `$a` `, 2) + pow(` `$b` `, 2))); ` ` ` `return` `$A` `; ` `} ` ` ` `// Driver code ` `$a` `= 8; ` `$b` `= 10; ` `echo` `circlearea(` `$a` `, ` `$b` `); ` ` ` `// This code is contributed by anuj_67 ` `?> ` |

*chevron_right*

*filter_none*

**Output:**

30.6341

## Recommended Posts:

- Radius of the biggest possible circle inscribed in rhombus which in turn is inscribed in a rectangle
- Area of the biggest possible rhombus that can be inscribed in a rectangle
- Area of a square inscribed in a circle which is inscribed in an equilateral triangle
- Area of a circle inscribed in a rectangle which is inscribed in a semicircle
- Area of a square inscribed in a circle which is inscribed in a hexagon
- Area of decagon inscribed within the circle
- Area of a circle inscribed in a regular hexagon
- Area of circle which is inscribed in equilateral triangle
- Find the area of largest circle inscribed in ellipse
- Program to calculate area of an Circle inscribed in a Square
- Find area of the larger circle when radius of the smaller circle and difference in the area is given
- Area of a triangle inscribed in a rectangle which is inscribed in an ellipse
- Program to calculate area and perimeter of a rhombus whose diagonals are given
- Program to calculate area of inner circle which passes through center of outer circle and touches its circumference
- The biggest possible circle that can be inscribed in a rectangle

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.