2.2(计算圆柱体的体积)编写程序,读入圆柱体的半径和高,并使用下列公式计算圆柱的体积: 面积 = 半径 × 半径 × π 体积 = 面积 × 高 下面是一个运行示例: Enter the radius and length of a cylinder:5.5 12 The area is 95.0331 The volume is 1140.4 2.2(Compute the volume of a cylinder) Write a program that reads the radius and length of a cylinder and computes the area and volume using the following formulas: area = radius × radius × π volume = area × length Here is a simple run: Enter the radius and length of a cylinder:5.5 12 The area is 95.0331 The volume is 1140.4 参考代码:
|