我是靠谱客的博主 强健蜗牛,这篇文章主要介绍计算圓柱体的体积,现在分享给大家,希望可以做个参考。

编写程序,读人圆柱体的半径和高,并使用下列公式计算圆柱的体积
                      面积 =半径 x 半径 x p
                      体积 = 面积 X 高
  代码如下:
import java.util.Scanner;

public class CylinderAreaVolume {
    
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter the radius and length of a cylinder");
        double radius = input.nextDouble();
        double length = input.nextDouble();
        double area = radius * radius * 3.14159;
        double volume = area * length;
        System.out.println("The area is" + area + "The volume is" + volume);
    }
    
}

运行结果:
在这里插入图片描述

最后

以上就是强健蜗牛最近收集整理的关于计算圓柱体的体积的全部内容,更多相关计算圓柱体内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(164)

评论列表共有 0 条评论

立即
投稿
返回
顶部