package P_12_09;
import java.util.Scanner;
/**
* Created with IntelliJ IDEA.
* Description: 本题计算人体的BMI BMI=体重÷身高的平方
* User:
* Date: 2021-12-10
* Time: 0:11
*/
public class BMI {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(sc.hasNextInt()){
int weight = sc.nextInt();
double height = sc.nextInt();
double bmi = weight / Math.pow(height,2);
// Math.pow 是某一数的平方的函数
if (bmi < 18.5){
System.out.println("Underweight");
}else if (bmi >= 18.5 && bmi <= 23.9 ) {
System.out.println("Normal");
}else if (bmi > 23.9 && bmi <= 27.9) {
System.out.println("Overweight");
}else {
System.out.println("Obese");
}
}
}
}
本题计算人体的 BMI BMI =体重÷身高的平方
2021/12/10 21:06:39
