Program to calculate the area between two Concentric Circles Last Updated : 23 Jun, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 = 1 Output : 9.42478 Input : X = 4, Y = 2 Output : 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: ?*X2 - ?*Y2 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; } 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. Python3 # 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 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. 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 ?> JavaScript <script> // Javascript program to find area between // the two given concentric circles // Function to find // nth concentric hexagon number function calculateArea(x, y) { // Declare value of pi var pi = 3.1415926536; // Calculate area of outer circle var arx = pi * x * x; // Calculate area of inner circle var ary = pi * y * y; // Difference in areas return arx - ary; } // Driver code var x = 2; var y = 1; // Function call document.write(calculateArea(x, y)); // This code is contributed by Ankita saini </script> Output: 9.42478 Time Complexity: O(1) Auxiliary Space: O(1) Comment More infoAdvertise with us Next Article Number of common tangents between two circles if their centers and radius is given A Abdullah Aslam Follow Improve Article Tags : Mathematical DSA school-programming circle Practice Tags : Mathematical Similar Reads Program to calculate area of an Circle inscribed in a Square Given the side of a square. The task is to find the area of an inscribed circle in a square.Examples: Input : a = 8 Output : Area of an inscribed circle: 50.24 Input : a = 12.04 Output : Area of an inscribed circle: 113.795 Given a square i.e. all sides of a square are of equal length and all four a 4 min read Program to calculate area of Enneagon Enneagon is a polygon with 9 sides and 9 internal angles. Enneagon is also known as Nonagon. A regular nonagon has an internal angle of 140 degrees each. Sum of interior angles of the nonagon is 1260 degree. The center of the circumcircle is also taken as the center of the regular Nonagon. The line 3 min read Program to calculate the Area and Perimeter of Incircle of an Equilateral Triangle Given the length of sides of an equilateral triangle, the task is to find the area and perimeter of Incircle of the given equilateral triangle. Examples: Input: side = 6 Output: Area = 9.4. Perimeter = 10.88 Input: side = 9 Output: Area = 21.21, Perimeter = 16.32 Properties of an Incircle are: The c 4 min read Program to calculate area of a parallelogram Given integers A and B denoting the length of sides of a parallelogram and Y that is the angle between the sides and length of diagonals D1 and D2 of the parallelogram and an angle 0 at the intersection of the diagonal, the task is to find the area of the parallelogram from the information provided. 7 min read Number of common tangents between two circles if their centers and radius is given Given two circles with a given radius and centers. The task is to find the number of common tangents between these circles.Examples: Input: x1 = -10, y1 = 8, x2 = 14, y2 = -24, r1 = 30, r2 = 10 Output: 3 Input: x1 = 40, y1 = 8, x2 = 14, y2 = 54, r1 = 39, r2 = 51 Output: 2 Approach: First of all we w 7 min read Program to calculate area of Circumcircle of an Equilateral Triangle Given the length of sides of an equilateral triangle. We need to write a program to find the area of Circumcircle of the given equilateral triangle.Examples: Input : side = 6 Output : Area of circumscribed circle is: 37.69 Input : side = 9 Output : Area of circumscribed circle is: 84.82 All three si 4 min read Like