给定整数C ,该整数C是通过外接圆的中心的外接圆的直角三角形的斜边的长度。任务是找到外接圆的区域。
例子:
Input: C = 8
Output: 50.26
Input: C = 10
Output: 78.53
方法:由于斜边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