# BMI練習題 ``` var weight = 85; // 假設85公斤 var height = 1.8; // 身高1米8 BMI = weight / (height * height); ``` if (BMI <= 18.5){ console.log("體重過輕"); } else if (18.5 <= BMI && BMI < 24) { console.log("正常範圍"); } else if (24 <= BMI && BMI < 27) { console.log("過重"); } else if (27 <= BMI && BMI < 30) { console.log("輕度肥胖"); } else if (30 <= BMI && BMI < 35){ console.log("中度肥胖"); } else if (35 <= BMI) { console.log("重度肥胖"); } console.log() //最後印出console.log("趨於哪個值") // 會印出 "過重"
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up