📜  正方形的外接圆的面积

📅  最后修改于: 2021-05-05 02:33:36             🧑  作者: Mango

给定正方形的边,然后找到围绕它的外接圆的面积。
例子:

Input : a = 6
Output : Area of a circumscribed circle is : 56.55

Input : a = 4
Output : Area of a circumscribed circle is : 25.13

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

圆方

外接圆的属性如下:

  • 外接圆的中心是正方形的两个对角线相交的点。
  • 正方形的外接圆是通过正方形的四个顶点构成的。
  • 正方形的外接圆的半径等于正方形的半径。

C++
// C++ Program to find the
// area of a circumscribed circle
#include 
#define PI 3.14159265
 
float areacircumscribed(float a)
{
    return (a * a * (PI / 2));
}
 
// Driver code
int main()
{
    float a = 6;
    printf(" Area of an circumscribed circle is : %.2f ",
           areacircumscribed(a));
    return 0;
}


Java
// Java program to calculate
// area of a circumscribed circle-square
import java.io.*;
class Gfg {
    // Utility Function
    static float areacircumscribed(float a)
    {
        float PI = 3.14159265f;
        return (a * a * (PI / 2));
    }
 
    // Driver Function
    public static void main(String arg[])
    {
        float a = 6;
        System.out.print("Area of an circumscribed"
                         + "circle is :");
        System.out.println(areacircumscribed(a));
    }
}
 
// The code is contributed by Anant Agarwal.


Python3
# Python3 Program to find the
# area of a circumscribed circle
PI = 3.14159265
 
def areacircumscribed(a):
 
    return (a * a * (PI / 2))
 
# Driver code
a = 6
print(" Area of an circumscribed circle is :",
        round(areacircumscribed(a), 2))
         
# This code is contributed by Smitha Dinesh Semwal


C#
// C# Program to find the
// area of a circumscribed circle
using System;
 
class GFG {
     
    public static double PI= 3.14159265 ;
 
    static float areacircumscribed(float a)
    {
        return (a * a * (float)(PI / 2));
    }
     
    // Driver code
    public static void Main()
    {
        float a = 6;
         
        Console.Write(" Area of an circumscribed"
                            + " circle is : {0}",
             Math.Round(areacircumscribed(a), 2));
    }
}
 
// This code is contributed by
// Smitha Dinesh Semwal


PHP


Javascript


输出 :

Area of an circumscribed circle is : 56.55