圆内十边形面积的 C 语言程序?
这里,我们将了解如何计算圆内十边形的面积。半径已给出。十边形的边长为“a”。

我们知道十边形的边长如下 −

因此面积为 −

示例
#include <iostream>
#include <cmath>
using namespace std;
float area(float r) {
if (r < 0) //if r is negative it is invalid
return -1;
float area = (5 * pow(r, 2) * (3 - sqrt(5)) * (sqrt(5) + (2 * sqrt(5)))) / 4;
return area;
}
int main() {
float r = 8;
cout << "Area : " << area(r);
}输出
Area : 409.969
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 语言编程
C++
C#
MongoDB
MySQL
Javascript
PHP