给定等边三角形的边长。我们需要编写一个程序来找到给定等边三角形的外接圆的面积。
例子:
Input : side = 6
Output : Area of circumscribed circle is: 37.69
Input : side = 9
Output : Area of circumscribed circle is: 84.82
等边三角形的所有三个边的长度相等,并且所有三个内角均为60度。
外接圆的属性如下:
- 外接圆的中心是等边三角形的中值相交的点。
- 等边三角形的外接圆穿过等边三角形的三个顶点。
- 等边三角形的外接圆的半径等于(a /√3),其中“ a”是等边三角形的边的长度。
下图显示了带有外接圆的等边三角形:
用于计算外接圆的面积的公式为:
(π*a2)/3
其中a是给定的等边三角形的边的长度。
这个公式如何运作?
我们知道圆的面积=π* r 2 ,其中r是给定圆的半径。
我们还知道等边三角形的外接圆半径=(等边三角形的边)/√3。
因此,面积=π* r 2 =π* a 2/3 。
C++
// C++ program to find the area of Cicumscribed
// circle of equilateral triangle
#include
#include
const double pi = 3.14159265358979323846;
using namespace std;
// function to calculate the area of circumcircle
// of equilateral triangle
float area_circumscribed(float a)
{
return (a * a * (pi / 3));
}
// Driver code
int main()
{
float a, Area;
a = 6;
// function calling
Area = area_circumscribed(a);
// displaying the area
cout << "Area of CircumCircle :" << Area;
return 0;
}
C
// C program to find the area of Cicumscribed
// circle of equilateral triangle
#include
#define PI 3.14159265
// function to find area of
// circumscribed circle
float area_circumscribed(float a)
{
return (a * a * (PI / 3));
}
// Driver code
int main()
{
float a = 6;
printf("Area of circumscribed circle is :%f",
area_circumscribed(a));
return 0;
}
Java
// Java code to find the area of circumscribed
// circle of equilateral 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 a)
{
return (a * a * (PI / 3));
}
// Driver code
public static void main(String[] args)
{
double a = 6.0;
System.out.println("Area of circumscribed circle is :"
+ area_cicumscribed(a));
}
}
Python3
# Python3 code to find the area of circumscribed
# circle of equilateral triangle
PI = 3.14159265
# Function to find the area of
# circumscribed circle
def area_cicumscribed(a):
return (a * a * (PI / 3))
# Driver code
a = 6.0
print("Area of circumscribed circle is :%f"
%area_cicumscribed(a))
# This code is contributed by Anant Agarwal.
C#
// C# code to find the area of
// circumscribed circle
// of equilateral triangle
using System;
class GFG {
static double PI = 3.14159265;
// function to find the area of
// circumscribed circle
public static double area_cicumscribed(double a)
{
return (a * a * (PI / 3));
}
// Driver code
public static void Main()
{
double a = 6.0;
Console.Write("Area of circumscribed circle is :" +
area_cicumscribed(a));
}
}
// This code is contributed by nitin mittal.
PHP
Javascript
输出:
Area of circumscribed circle is :37.6991118