计算八边形面积的程序
八边形是具有八个边的多边形。要计算八边形的面积,请使用以下公式,
八边形的面积=((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 幼儿狗年祝福语大全简短
18 好听的元旦简短祝福语