第四章第四题(几何:六边形面积)(Geometry: area of a hexagon)
-
4.4(几何:六边形面积)六边形面积可以通过下面公式计算(s是边长):
编写程序,提示用户输入六边形的边长,然后显示它的面积。
下面是一个运行示例:Enter the side: 5.5
The area of the hexagon is 78.59
4.4(Geometry: area of a hexagon) The area of a hexagon can be computed using the following formula (s is the length of a side):
Write a program that prompts the user to enter the side of a hexagon and displays its area.Here is a sample run:
Enter the side: 5.5
The area of the hexagon is 78.59
-
参考代码: