计算八边形面积的程序
八边形是具有八个边的多边形。要计算八边形的面积,请使用以下公式,
八边形的面积=((a2*2)/*tan(22.5°))=((2*a*a)(1+√2))
代码逻辑,使用上述公式计算具有八个边的多边形的面积。该表达式使用sqrt函数查找2的平方根。该表达式的值被评估为浮点值,该值被放入float区域变量中。
示例
#include <stdio.h>
#include <math.h>
int main(){
int a = 7;
float area;
float multiplier = 6.18;
printf("Program to find area of octagon \n");
printf("The side of the octagon is %d \n", a);
area = ((2*a*a)*(1 + sqrt(2)));
printf("The area of Enneagon is %f \n", area);
return 0;
}输出结果
Program to find area of octagon The side of the octagon is 7 The area of Enneagon is 236.592926
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短