📜  直角三角形的圆周面积

📅  最后修改于: 2021-10-23 08:29:48             🧑  作者: Mango

给定一个整数C ,它是通过外接圆中心的外接圆的直角三角形的斜边的长度。任务是找到外接圆的面积。

例子:

方法:由于斜边C通过圆心,所以圆的半径将为C / 2
我们知道圆的面积是PI * r 2其中PI = 22 / 7并且r是圆的半径。
因此外接圆的面积将是PI * (C / 2) 2 ,PI * C 2 / 4
下面是上述方法的实现:

C++
// C++ program to find the area of Cicumscribed
// circle of right angled triangle
#include 
#define PI 3.14159265
using namespace std;
 
// Function to find area of
// circumscribed circle
float area_circumscribed(float c)
{
    return (c * c * (PI / 4));
}
 
// Driver code
int main()
{
    float c = 8;
    cout << area_circumscribed(c);
    return 0;
}
 
// This code is contributed by Shivi_Aggarwal


C
// C program to find the area of Cicumscribed
// circle of right angled triangle
#include 
#define PI 3.14159265
 
// Function to find area of
// circumscribed circle
float area_circumscribed(float c)
{
    return (c * c * (PI / 4));
}
 
// Driver code
int main()
{
    float c = 8;
    printf("%f",
           area_circumscribed(c));
    return 0;
}


Java
// Java code to find the area of circumscribed
// circle of right angled triangle
import java.lang.*;
 
class GFG {
 
    static double PI = 3.14159265;
 
    // Function to find the area of
    // circumscribed circle
    public static double area_cicumscribed(double c)
    {
        return (c * c * (PI / 4));
    }
 
    // Driver code
    public static void main(String[] args)
    {
        double c = 8.0;
        System.out.println(area_cicumscribed(c));
    }
}


Python3
# Python3 code to find the area of circumscribed
# circle of right angled triangle
PI = 3.14159265
     
# Function to find the area of
# circumscribed circle
def area_cicumscribed(c):
    return (c * c * (PI / 4))
     
# Driver code
c = 8.0
print(area_cicumscribed(c))


C#
// C# code to find the area of
// circumscribed circle
// of right angled triangle
using System;
 
class GFG {
    static double PI = 3.14159265;
 
    // Function to find the area of
    // circumscribed circle
    public static double area_cicumscribed(double c)
    {
        return (c * c * (PI / 4));
    }
 
    // Driver code
    public static void Main()
    {
        double c = 8.0;
        Console.Write(area_cicumscribed(c));
    }
}


PHP


Javascript


输出:
50.265484

如果您希望与专家一起参加现场课程,请参阅DSA 现场工作专业课程学生竞争性编程现场课程