public class Main {
public static void main(String[] args) {
double height = 1.7;
double weight = 65;
double BMI = weight/(height*height);
System.out.printf("BMI = %.2f\n", BMI);
if (BMI > 32) {
System.out.println("Very much overweight");
} else if (BMI > 28) {
System.out.println("Overweight");
} else if (BMI > 25) {
System.out.println("Slightly overweight");
} else if (BMI > 18.5) {
System.out.println("Healthy");
} else {
System.out.println("Malnutrition");
}
Sign in to make a reply
用户7629784270
public class Main {
public static void main(String[] args) {
double height = 1.7;
double weight = 65;
double BMI = weight/(height*height);
System.out.printf("BMI = %.2f\n", BMI);
if (BMI > 32) {
System.out.println("Very much overweight");
} else if (BMI > 28) {
System.out.println("Overweight");
} else if (BMI > 25) {
System.out.println("Slightly overweight");
} else if (BMI > 18.5) {
System.out.println("Healthy");
} else {
System.out.println("Malnutrition");
}
}
}