Given the side of a square a which is kept inside a circle. It keeps expanding until all four of its vertices touch the circumference of the circle. Another smaller circle is kept inside the square now and it keeps expanding until its circumference touches all the four sides of the square. The outer and the inner circle form a ring. Find the area of this shaded part as shown in the image below.
Input: a = 3
Input: a = 4
From the above figure, R = a / sqrt(2) can be derived where a is the side length of the square. The area of the outer circle is (pi * R * R).
Let s1 be the area of the outer circle (pi * R * R) and s2 be the area of the inner circle (pi * r * r). Then the area of the ring is s1 – s2.
Below is the implementation of the above approach:
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Area of a square inscribed in a circle which is inscribed in an equilateral triangle
- Area of a square inscribed in a circle which is inscribed in a hexagon
- Program to calculate area of an Circle inscribed in a Square
- Area of a circle inscribed in a rectangle which is inscribed in a semicircle
- Area of decagon inscribed within the circle
- Area of circle inscribed within rhombus
- Area of circle inscribed in a Isosceles Trapezoid
- Area of largest Circle that can be inscribed in a SemiCircle
- Area of circle which is inscribed in equilateral triangle
- Area of a circle inscribed in a regular hexagon
- Find area of the larger circle when radius of the smaller circle and difference in the area is given
- Find the area of largest circle inscribed in ellipse
- Area of Equilateral triangle inscribed in a Circle of radius R
- Biggest Reuleaux Triangle within a Square which is inscribed within a Circle
- Area of a Circumscribed Circle of a Square
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.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.
Improved By : mohit kumar 29