Given two concentric circles with radius X and Y where (X > Y). Find the area between them.
You are required to find the area of the green region as shown in the following image:
Input : X = 2, Y = 1 Output : 9.42478 Input : X = 4, Y = 2 Output : 37.6991
The area between the two given concentric circles can be calculated by subtracting the area of the inner circle from the area of the outer circle. Since X>Y. X is the radius of the outer circle.
Therefore, area between the two given concentric circles will be:
π*X2 - π*Y2
Below is the implementation of the above approach:
Time Complexity: O(1)
- Check if a given circle lies completely inside the ring formed by two concentric circles
- Program to calculate Area Of Octagon
- Program to calculate area and volume of a Tetrahedron
- Program to calculate area and perimeter of a rhombus whose diagonals are given
- Program to calculate the Surface Area of a Triangular Prism
- Program to calculate area of an Circle inscribed in a Square
- Program to calculate the Area and Perimeter of Incircle of an Equilateral Triangle
- Calculate Stirling numbers which represents the number of ways to arrange r objects around n different circles
- Calculate Volume, Curved Surface Area and Total Surface Area Of Cylinder
- Calculate area of pentagon with given diagonal
- Calculate volume and surface area of Torus
- C program to calculate the value of nPr
- Program to calculate the value of sin(x) and cos(x)
- Program to calculate value of nCr
- Program to calculate the value of nCr Efficiently
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.