public static void main(String args[]) {
double height = 1.68;
double weight = 55;
double MBI = (weight) / (height * height);
if (MBI < 18.5) {
System.out.printf("你的MBI: %s 过轻:低于18.5", MBI);
} else if (MBI >= 18.5 && MBI < 25) {
System.out.printf("你的MBI: %s 正常:18.5-25", MBI);
} else if (MBI >= 25 && MBI < 28) {
System.out.printf("你的MBI: %s 过重:25-28", MBI);
} else if (MBI >= 28 && MBI < 32) {
System.out.printf("你的MBI: %s 肥胖:28-32", MBI);
} else if (MBI >= 32) {
System.out.printf("你的MBI: %s 非常肥胖:高于32", MBI);
}
Sign in to make a reply
陆佩廷
public static void main(String args[]) {
double height = 1.68;
double weight = 55;
double MBI = (weight) / (height * height);
if (MBI < 18.5) {
System.out.printf("你的MBI: %s 过轻:低于18.5", MBI);
} else if (MBI >= 18.5 && MBI < 25) {
System.out.printf("你的MBI: %s 正常:18.5-25", MBI);
} else if (MBI >= 25 && MBI < 28) {
System.out.printf("你的MBI: %s 过重:25-28", MBI);
} else if (MBI >= 28 && MBI < 32) {
System.out.printf("你的MBI: %s 肥胖:28-32", MBI);
} else if (MBI >= 32) {
System.out.printf("你的MBI: %s 非常肥胖:高于32", MBI);
}
}