C ++程序中正五角形的对角线
在本教程中,我们将学习如何找到正五边形的对角线。
我们必须使用给定的边找到正五边形的对角线长度。正五边形的对角线长度为1.22*s,其中s是五边形的边。
示例
让我们看一下代码。
#include <bits/stdc++.h>
using namespace std;
float pentagonDiagonal(float s) {
if (s < 0) {
return -1;
}
return 1.22 * s;
}
int main() {
float s = 7;
cout << pentagonDiagonal(s) << endl;
return 0;
}输出结果8.54
结论
热门推荐
10 祝女儿简短祝福语大全
11 大学新年祝福语简短创意
12 元旦适合的祝福语简短
13 朋友出远门祝福语简短
14 初六简短的祝福语
15 祝男孩生日祝福语简短
16 同事调离的祝福语简短
17 拜年红包的祝福语简短
18 妈妈生日祝福语简短励志