package chaper2;
import java.util.Scanner;
/**
* 通过输入半径和高求圆柱体的体积
* V=S底面积*H高
* @author siyihe
* @create 2022-06-23 12:55
* @project javaexec0
*/
public class Cylinder {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
System.out.println("Enter thr radius and length of a cylinder:");
double radius=input.nextDouble();
double length=input.nextDouble();
double area= Math.PI*radius*radius;
double volume=area*length;
System.out.println("The area is "+area);
System.out.println("The volume is "+volume);
}
}
根据输入的半径和高求圆柱体的底面积和体积
最新推荐文章于 2023-11-15 23:53:57 发布