"use Strict"
var height = parseFloat(prompt('请输入身高(m):'));
var weight = parseFloat(prompt('请输入体重(kg):'));
var bim = weight / height * height;
if (bim > 0) {
if (bim < 18.5) {
alert("过轻");
} else if (bim >= 18.5 && bim < 25) {
alert("正常");
} else if (bim >= 25 && bim < 28) {
alert("过重");
} else if (bim >= 28 && bim < 32) {
alert("肥胖");
} else if (bim >= 32) {
alert("严重肥胖");
}
} else {
alert("输入错误");
Sign in to make a reply
用户6522882218
"use Strict"
var height = parseFloat(prompt('请输入身高(m):'));
var weight = parseFloat(prompt('请输入体重(kg):'));
var bim = weight / height * height;
if (bim > 0) {
if (bim < 18.5) {
alert("过轻");
} else if (bim >= 18.5 && bim < 25) {
alert("正常");
} else if (bim >= 25 && bim < 28) {
alert("过重");
} else if (bim >= 28 && bim < 32) {
alert("肥胖");
} else if (bim >= 32) {
alert("严重肥胖");
}
} else {
alert("输入错误");
}