查找五边形面积的程序

2025 年 3 月 17 日 | 阅读 1 分钟

五边形定义为一个具有 5 条相等边的多边形。五边形中的 5 个角也相等。一个五边形可以被分成 5 个相似的三角形。正五边形的每个内角测量值为 108 度。

Program to find the area of a pentagon

计算五边形面积的公式为:

Program to find the area of a pentagon

其中

s 是五边形的边长。
a 是边心距长度。

算法

  1. 创建变量 's' 和 'a' 并将它们的值分别设为 10 和 6。
  2. 根据计算五边形面积的公式,创建变量 area_pentagon,其值为 (5/2)X(s)X(a)。

复杂度

O(1)


解决方案

C 语言程序

输出

Area of the pentagon=162.5  

PHP 程序

输出

Area of the pentagon=162.5  

Java 程序

输出

Area of the pentagon=162.5

C# 程序

输出

Area of the pentagon=162.5

Python 程序

输出

Area of the pentagon=162.5
 
下一主题#