📜  圆外接圆的面积

📅  最后修改于: 2021-05-04 12:49:05             🧑  作者: Mango

给定圆的半径(r),然后找到由圆外接的正方形的面积。
例子:

Input : r = 3
Output :Area of square = 18

Input :r = 6
Output :Area of square = 72

正方形的所有四个边的长度相等,并且所有四个角度均为90度。圆在下图的阴影区域所示的给定正方形上外接。

外接圆的属性如下:

  • 外接圆的中心是正方形的两个对角线相交的点。
  • 正方形的外接圆是通过正方形的四个顶点构成的。
  • 正方形的外接圆的半径等于正方形的半径。
CPP
// C++ program to find Area of
// square Circumscribed by Circle
#include 
using namespace std;
 
// Function to find area of square
int find_Area(int r)
{
    return (2 * r * r);
}
 
// Driver code
int main()
{
    // Radius of a circle
    int r = 3;
     
    // Call Function to find
    // an area of square
    cout << " Area of square = "
                 << find_Area(r);
     
    return 0;
}


Java
// Java program to find Area of
// square Circumscribed by Circle
class GFG {
     
    // Function to find area of square
    static int find_Area(int r)
    {
        return (2 * r * r);
    }
     
    // Driver code
    public static void main(String[] args)
    {
        // Radius of a circle
        int r = 3;
 
        // Call Function to find
        // an area of square
        System.out.print(" Area of square = "
                             + find_Area(r));
    }
}
 
// This code is contributed by Anant Agarwal.


Python3
# Python program to
# find Area of
# square Circumscribed
# by Circle
 
# Function to find
# area of square
def find_Area(r):
 
    return (2 * r * r)
     
# driver code
# Radius of a circle
r = 3
     
# Call Function to find
# an area of square
print(" Area of square = ", find_Area(r))
 
# This code is contributed
# by Anant Agarwal.


C#
// C# program to find Area of
// square Circumscribed by Circle
using System;
 
class GFG {
     
    // Function to find area of square
    static int find_Area(int r)
    {
        return (2 * r * r);
    }
     
    // Driver code
    public static void Main()
    {
        // Radius of a circle
        int r = 3;
 
        // Call Function to find
        // an area of square
        Console.WriteLine(" Area of square = "
                            + find_Area(r));
    }
}
 
// This code is contributed by vt_m.


PHP


Javascript


输出:

Area of square = 18

时间复杂度:O(1)