BMI Calculator


Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 64M

Authors:
Problem type

BMI計算並判斷類別

輸入限制: 數字

Input

身高(公尺)、體重(公斤)

Output

體重的類別

Sample Input

1.60
60

Sample Output

Healthy

Comments


  • 0
    scu12156261  commented on Oct. 12, 2023, 11:29 p.m.

    import java.util.Scanner;

    public class lin01 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner s=new Scanner(System.in);
        double g=s.nextDouble();
        int p=s.nextInt();
        double bmi=p/(g*g);
        if(bmi>=27) {
            System.out.print("Obese");
        }
        else if(bmi>=24) {
            System.out.print("Fat");
        }
        else if(bmi>=18.5) {
            System.out.print("Healthy");
        }
        else {
            System.out.println("Light");
    
        }
    }

    }


  • 0
    guest_2  commented on Oct. 11, 2023, 8:04 p.m. edit 5

    BMI < 18.5:Light,

    18.5 <= BMI < 24:Healthy,

    24 <= BMI < 27:Fat,

    BMI >= 27:Obese

    體重/身高平方