enneagon也称为nonagon是具有9个边的多边形。要计算enneagon的面积,请使用以下公式,
触角面积=((a 2 * 9)/ 4 * tan(20°))〜=(6.18 * a2)
代码逻辑,使用公式((a 2 * 9)/ 4 * tan(20°))〜=(6.18 * a2)计算具有九个边的多边形的面积。将值6.18填充到称为乘数的浮点变量中,然后将该值乘以enneagon边的平方。
#include <stdio.h> #include <math.h> int main(){ int a = 6; float area; float multiplier = 6.18; printf("Program to find area of Enneagon \n"); printf("The side of the Enneagon is %d \n", a); area = (6.18 * a * a); printf("The area of Enneagon is %f \n", area); return 0; }
输出结果
Program to find area of Enneagon The side of the Enneagon is 6 The area of Enneagon is 222.479996