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:

**Examples:**

Input :X = 2, Y = 1Output :9.42478Input :X = 4, Y = 2Output :37.6991

**Approach:**

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:

π*X^{2}- π*Y^{2}

Below is the implementation of the above approach:

## C++

`// C++ program to find area between the ` `// two given concentric circles ` ` ` `#include <bits/stdc++.h> ` `using` `namespace` `std; ` ` ` `// Function to find area between the ` `// two given concentric circles ` `double` `calculateArea(` `int` `x, ` `int` `y) ` `{ ` ` ` `// Declare value of pi ` ` ` `double` `pi = 3.1415926536; ` ` ` ` ` `// Calculate area of outer circle ` ` ` `double` `arx = pi * x * x; ` ` ` ` ` `// Calculate area of inner circle ` ` ` `double` `ary = pi * y * y; ` ` ` ` ` `// Difference in areas ` ` ` `return` `arx - ary; ` `} ` ` ` `// Driver Program ` `int` `main() ` `{ ` ` ` `int` `x = 2; ` ` ` `int` `y = 1; ` ` ` ` ` `cout << calculateArea(x, y); ` ` ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java program to find area between the ` `// two given concentric circles ` `import` `java.io.*; ` ` ` `class` `GFG ` `{ ` ` ` `// Function to find area between the ` `// two given concentric circles ` `static` `double` `calculateArea(` `int` `x, ` `int` `y) ` `{ ` ` ` `// Declare value of pi ` ` ` `double` `pi = ` `3.1415926536` `; ` ` ` ` ` `// Calculate area of outer circle ` ` ` `double` `arx = pi * x * x; ` ` ` ` ` `// Calculate area of inner circle ` ` ` `double` `ary = pi * y * y; ` ` ` ` ` `// Difference in areas ` ` ` `return` `arx - ary; ` `} ` ` ` `// Driver code ` `public` `static` `void` `main (String[] args) ` `{ ` ` ` `int` `x = ` `2` `; ` ` ` `int` `y = ` `1` `; ` ` ` `System.out.println (calculateArea(x, y)); ` `} ` `} ` ` ` `// This code is contributed by jit_t. ` |

*chevron_right*

*filter_none*

## Python 3

`# Python3 program to find area between ` `# the two given concentric circles ` ` ` `# Function to find area between the ` `# two given concentric circles ` `def` `calculateArea(x, y): ` ` ` ` ` `# Declare value of pi ` ` ` `pi ` `=` `3.1415926536` ` ` ` ` `# Calculate area of outer circle ` ` ` `arx ` `=` `pi ` `*` `x ` `*` `x ` ` ` ` ` `# Calculate area of inner circle ` ` ` `ary ` `=` `pi ` `*` `y ` `*` `y ` ` ` ` ` `# Difference in areas ` ` ` `return` `arx ` `-` `ary ` ` ` `# Driver Code ` `x ` `=` `2` `y ` `=` `1` ` ` `print` `(calculateArea(x, y)) ` ` ` `# This code is contributed ` `# by shashank_sharma ` |

*chevron_right*

*filter_none*

## C#

`// C# program to find area between the ` `// two given concentric circles ` `using` `System; ` ` ` `class` `GFG ` `{ ` ` ` `// Function to find area between the ` `// two given concentric circles ` `static` `double` `calculateArea(` `int` `x, ` `int` `y) ` `{ ` ` ` `// Declare value of pi ` ` ` `double` `pi = 3.1415926536; ` ` ` ` ` `// Calculate area of outer circle ` ` ` `double` `arx = pi * x * x; ` ` ` ` ` `// Calculate area of inner circle ` ` ` `double` `ary = pi * y * y; ` ` ` ` ` `// Difference in areas ` ` ` `return` `arx - ary; ` `} ` ` ` `// Driver code ` `public` `static` `void` `Main () ` `{ ` ` ` `int` `x = 2; ` ` ` `int` `y = 1; ` ` ` `Console.WriteLine(calculateArea(x, y)); ` `} ` `} ` ` ` `// This code is contributed by Code_Mech. ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP program to find area between the ` `// two given concentric circles ` ` ` `// Function to find area between the ` `// two given concentric circles ` `function` `calculateArea(` `$x` `, ` `$y` `) ` `{ ` ` ` `// Declare value of pi ` ` ` `$pi` `= 3.1415926536; ` ` ` ` ` `// Calculate area of outer circle ` ` ` `$arx` `= ` `$pi` `* ` `$x` `* ` `$x` `; ` ` ` ` ` `// Calculate area of inner circle ` ` ` `$ary` `= ` `$pi` `* ` `$y` `* ` `$y` `; ` ` ` ` ` `// Difference in areas ` ` ` `return` `(` `$arx` `- ` `$ary` `); ` `} ` ` ` `// Driver Code ` `$x` `= 2; ` `$y` `= 1; ` ` ` `echo` `calculateArea(` `$x` `, ` `$y` `); ` ` ` `// This code is contributed by akt_mit ` `?> ` |

*chevron_right*

*filter_none*

**Output:**

9.42478

**Time Complexity:** O(1)

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:

- Check if a given circle lies completely inside the ring formed by two concentric circles
- Ratio of the distance between the centers of the circles and the point of intersection of two direct common tangents to the circles
- Ratio of the distance between the centers of the circles and the point of intersection of two transverse common tangents to the circles
- Program to check if N is a Concentric Hexagonal Number
- Calculate Volume, Curved Surface Area and Total Surface Area Of Cylinder
- Calculate Stirling numbers which represents the number of ways to arrange r objects around n different circles
- Concentric Hexagonal Numbers
- Length of the transverse common tangent between the two non intersecting circles
- Length of the direct common tangent between two externally touching circles
- Length of direct common tangent between the two non-intersecting Circles
- Length of direct common tangent between two intersecting Circles
- Number of common tangents between two circles if their centers and radius is given
- Distance between centers of two intersecting circles if the radii and common chord length is given
- Program to calculate area and volume of a Tetrahedron
- Program to calculate Area Of Octagon
- Program to calculate the Surface Area of a Triangular Prism
- Program to calculate area of an Circle inscribed in a Square
- Program to calculate area of inner circle which passes through center of outer circle and touches its circumference
- Program to calculate area and perimeter of a rhombus whose diagonals are given
- Program to calculate the Area and Perimeter of Incircle of an 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.