import java.util.Scanner;
public class Solution1 {
public static void main (String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Please input your height: ");
double height = input.nextDouble();
System.out.print("Please input your weight: ");
double weight = input.nextDouble();
double BMI = weight/(height*height);
if (BMI < 18.5) {
System.out.println("You are so light! ");
}
else if (BMI < 25) {
System.out.println("You are normal!");
else if (BMI < 28) {
System.out.println("You are overweight!");
else if (BMI < 32) {
System.out.println("You are fat!");
else {
System.out.println("You are very fat!");
input.close();
Sign in to make a reply
夜游蛇
import java.util.Scanner;
public class Solution1 {
public static void main (String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Please input your height: ");
double height = input.nextDouble();
System.out.print("Please input your weight: ");
double weight = input.nextDouble();
double BMI = weight/(height*height);
if (BMI < 18.5) {
System.out.println("You are so light! ");
}
else if (BMI < 25) {
System.out.println("You are normal!");
}
else if (BMI < 28) {
System.out.println("You are overweight!");
}
else if (BMI < 32) {
System.out.println("You are fat!");
}
else {
System.out.println("You are very fat!");
}
input.close();
}
}