编写程序,读入圆柱体的半径,高,并使用公式计算圆柱的面积,体积
public class ricals {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input =new Scanner(System.in);
final double PI=3.14159;
System.out.println("Enter the radious of a cylinder:");
int radious =input.nextInt();
System.out.println("Enter the length of a cylinder:");
int length=input.nextInt();
double area=radious * radious*PI;
double volume =area*length;
System.out.println("the area is "+area);
System.out.println("the volume is "+volume);
}
}
输出: