三角形中内接圆的面积( C程序)?


在这里,我们将看到内接于等边三角形的圆的面积。三角形的边长为“a”。

等边 三角形的面积为 -

三角形的半周长为 -

所以,圆的半径为 -

示例

#include <iostream>
#include <cmath>
using namespace std;
float area(float a) {
   if (a < 0 ) //if the value is negative it is invalid
      return -1;
   float area = 3.1415 * (a/(2*sqrt(3))) * (a/(2*sqrt(3)));
   return area;
}
int main() {
   float a = 4;
   cout << "Area is: " << area(a);
}

输出

Area is: 4.18867

更新时间: 20-8-2019

244 次浏览

开启你的职业生涯

完成课程即可获得认证

开始
广告
© . All rights reserved.