Given a rectangle of length **l** & breadth **b**, we have to find the largest cricle that can be inscribed in the rectangle.

**Examples:**

Input : l = 4, b = 8 Output : 12.56 Input : l = 16 b = 6 Output : 28.26

From the figure, we can see, the biggest circle that could be inscribed in the rectangle will have radius always equal to the half of the shorter side of the rectangle. So from the figure,

radius,

r = b/2&

Area,A = π * (r^2)

## C++

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

*chevron_right*

*filter_none*

## Java

`// Java Program to find the ` `// biggest circle which can be ` `// inscribed within the rectangle ` ` ` `class` `GFG ` `{ ` ` ` `// Function to find the area ` `// of the biggest circle ` `static` `float` `circlearea(` `float` `l, ` ` ` `float` `b) ` `{ ` ` ` `// the length and breadth ` `// cannot be negative ` `if` `(l < ` `0` `|| b < ` `0` `) ` ` ` `return` `-` `1` `; ` ` ` `// area of the circle ` `if` `(l < b) ` ` ` `return` `(` `float` `)(` `3.14` `* Math.pow(l / ` `2` `, ` `2` `)); ` `else` ` ` `return` `(` `float` `)(` `3.14` `* Math.pow(b / ` `2` `, ` `2` `)); ` `} ` ` ` `// Driver code ` `public` `static` `void` `main(String[] args) ` `{ ` ` ` `float` `l = ` `4` `, b = ` `8` `; ` ` ` `System.out.println(circlearea(l, b)); ` `} ` `} ` ` ` `// This code is contributed ` `// by ChitraNayal ` |

*chevron_right*

*filter_none*

## Python 3

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

*chevron_right*

*filter_none*

## C#

`// C# Program to find the ` `// biggest circle which can be ` `// inscribed within the rectangle ` `using` `System; ` ` ` `class` `GFG ` `{ ` ` ` `// Function to find the area ` `// of the biggest circle ` `static` `float` `circlearea(` `float` `l, ` ` ` `float` `b) ` `{ ` ` ` `// the length and breadth ` `// cannot be negative ` `if` `(l < 0 || b < 0) ` ` ` `return` `-1; ` ` ` `// area of the circle ` `if` `(l < b) ` ` ` `return` `(` `float` `)(3.14 * Math.Pow(l / 2, 2)); ` `else` ` ` `return` `(` `float` `)(3.14 * Math.Pow(b / 2, 2)); ` `} ` ` ` `// Driver code ` `public` `static` `void` `Main() ` `{ ` ` ` `float` `l = 4, b = 8; ` ` ` `Console.Write(circlearea(l, b)); ` `} ` `} ` ` ` `// This code is contributed ` `// by ChitraNayal ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP Program to find the ` `// biggest circle which can be ` `// inscribed within the rectangle ` ` ` `// Function to find the area ` `// of the biggest circle ` `function` `circlearea(` `$l` `, ` `$b` `) ` `{ ` ` ` ` ` `// the length and breadth ` ` ` `// cannot be negative ` ` ` `if` `(` `$l` `< 0 || ` `$b` `< 0) ` ` ` `return` `-1; ` ` ` ` ` `// area of the circle ` ` ` `if` `(` `$l` `< ` `$b` `) ` ` ` `return` `3.14 * pow(` `$l` `/ 2, 2); ` ` ` `else` ` ` `return` `3.14 * pow(` `$b` `/ 2, 2); ` `} ` ` ` `// Driver code ` `$l` `= 4; ` `$b` `= 8; ` `echo` `circlearea(` `$l` `, ` `$b` `).` `"\n"` `; ` ` ` `// This code is contributed ` `// by ChitraNayal ` `?> ` |

*chevron_right*

*filter_none*

**Output:**

12.56

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.

## 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 the biggest ellipse inscribed within a rectangle
- Biggest Reuleaux Triangle within a Square which is inscribed within a Circle
- Biggest Reuleaux Triangle inscribed within a square which is inscribed within an ellipse
- Biggest Reuleaux Triangle inscribed within a square which is inscribed within a hexagon
- Area of a triangle inscribed in a rectangle which is inscribed in an ellipse
- Biggest Reuleaux Triangle inscribed within a Square inscribed in an equilateral triangle
- Area of a square inscribed in a circle which is inscribed in an equilateral triangle
- Biggest Square that can be inscribed within an Equilateral triangle
- Area of the circle that has a square and a circle inscribed in it
- Biggest Reuleaux Triangle inscirbed within a square inscribed in a semicircle
- Largest rectangle that can be inscribed in a semicircle
- Area of largest triangle that can be inscribed within a rectangle
- Area of Largest rectangle that can be inscribed in an Ellipse
- Maximum area of rectangle inscribed in an equilateral triangle
- Biggest Reuleaux Triangle within a Square which is inscribed within a Right angle Triangle
- Area of decagon inscribed within the circle
- Area of circle inscribed within rhombus
- Area of circle which is inscribed in equilateral triangle

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.