三角形中內接圓的面積( 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
廣告
資料結構
網路化
關係資料庫管理系統 (RDBMS)
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP