import java.util.Scanner;
public class 体重指数 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("input your weight(kg):");
double weight = scanner.nextDouble();
System.out.print("input your height(m):");
double height = scanner.nextDouble();
double BMI = ((double) weight / (height * height));
if (BMI < 18.5) {
System.out.print("竹竿");
} else if (BMI >= 18.5 && BMI < 25) {
System.out.print("正常");
} else if (BMI >= 25 && BMI < 28) {
System.out.print("能吃");
} else if (BMI >= 28 && BMI < 32) {
System.out.print("超能吃");
} else if (BMI >= 32) {
System.out.print("非常能吃");
}
scanner.close();
Sign in to make a reply
对酒当歌
import java.util.Scanner;
public class 体重指数 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("input your weight(kg):");
double weight = scanner.nextDouble();
System.out.print("input your height(m):");
double height = scanner.nextDouble();
double BMI = ((double) weight / (height * height));
if (BMI < 18.5) {
System.out.print("竹竿");
} else if (BMI >= 18.5 && BMI < 25) {
System.out.print("正常");
} else if (BMI >= 25 && BMI < 28) {
System.out.print("能吃");
} else if (BMI >= 28 && BMI < 32) {
System.out.print("超能吃");
} else if (BMI >= 32) {
System.out.print("非常能吃");
}
scanner.close();
}
}