|
// Java求长方体体积
|
|
package xiangmu;
|
|
import java.util.Scanner;
|
|
|
|
public class Ceshi {
|
|
public static void main(String args[]) {
|
|
Scanner sc = new Scanner(System.in);
|
|
dayin("请输入长方体的长:");
|
|
int ch = sc.nextInt();
|
|
dayin("请输入长方体的宽:");
|
|
int k = sc.nextInt();
|
|
dayin("请输入长方体的高:");
|
|
int g = sc.nextInt();
|
|
int tiji = qiutiji(ch, k, g);
|
|
dayin("这个长方体的体积为:" + tiji);
|
|
sc.close();
|
|
}
|
|
public static int qiutiji(int chang, int kuan, int gao) {
|
|
int t = chang * kuan * gao;
|
|
return t;
|
|
}
|
|
public static void dayin(String zifuchuan) {
|
|
System.out.print(zifuchuan);
|
|
}
|
|
}
|
请输入长方体的长:5
请输入长方体的宽:3
请输入长方体的高:4
这个长方体的体积为:60