📜  等边三角形内切圆的面积

📅  最后修改于: 2021-10-23 09:04:45             🧑  作者: Mango

给定一个边长为 a 的等边三角形,任务是找到该等边三角形内切圆的面积。
例子:

Input : a = 4
Output : 4.1887902047863905

Input : a = 10
Output : 26.1799387799

方法:

下面是上述方法的实现:

C++
*** QuickLaTeX cannot compile formula:
 

*** Error message:
Error: Nothing to show, formula is empty


Java
*** QuickLaTeX cannot compile formula:
 

*** Error message:
Error: Nothing to show, formula is empty


Python3
*** QuickLaTeX cannot compile formula:
 

*** Error message:
Error: Nothing to show, formula is empty


C#
*** QuickLaTeX cannot compile formula:
 

*** Error message:
Error: Nothing to show, formula is empty


PHP
// C++ program to find the area
// of circle which is inscribed
// in equilateral triangle
# include
# define PI 3.14
using namespace std;
 
// Function return the area of circle
// inscribed in equilateral triangle
float circle_inscribed(int a)
{
    return PI * (a * a) / 12;
}
 
// Driver code
int main()
{
    int a = 4;
 
    cout << circle_inscribed(a);
    return 0;
}
 
// This code is contributed
// by Mahadev99


Javascript
// Java program to find the area
// of circle which is inscribed
// in equilateral triangle
import java.io.*;
 
class GFG
{
 
static double PI = 3.14;
 
// Function return the area of circle
// inscribed in equilateral triangle
static double circle_inscribed(int a)
{
    return PI * (a * a) / 12;
}
 
// Driver code
public static void main (String[] args)
{
    int a = 4;
 
    System.out.println(circle_inscribed(a));
}
}
 
// This code is contributed by anuj_67


输出:

# Python3 program to find the area of circle
# which is inscribed in equilateral triangle
 
# import math library for pi value
from math import pi
 
# Function return the area of circle
# inscribed in equilateral triangle
def circle_inscribed(a):
    return pi*(a * a) / 12
 
# Driver code
a = 4
print(circle_inscribed(a))

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