怎么用python算bmi 简单编程 在线等

weight=int(raw_input(\"请输入体重(千克):\"))

怎么用python算bmi 简单编程 在线等

文章插图
height=int(raw_input(\"请输入身高(米):\"))
怎么用python算bmi 简单编程 在线等

文章插图
BMI=weight/(height*height)
print \"BMI=\",BMI
ifBMI<19:
print“轻体重\"
elifBMI>=19 and BMI<25:
print\"健康身体\"
elif BMI>=25 and BMI<28:
print\"超重“
else:
print\"肥胖”
raw_input(\"press any key to quit.\")
如何用JAVA写一个能算BMI的程序试试这个
public class bmi {
public static void main(string[] args){
float bmi;
bmi=17.6;
switch ((bmi-16)>0){
case false:
system.out.print(\"严重偏轻\");
break;
case true:
switch ((bmi-18)>0){
case false:
system.out.print(\"偏轻\");
break;
case true:
switch ((bmi-24)>0){
case false:
system.out.print(\"正常体重\");
break;
case true:
switch ((bmi-29)>0){
case false:
system.out.print(\"超重\");
break;
case true:
switch ((bmi-35)>0){
case false:
system.out.print(\"严重超重\");
break;
case true:
system.out.print(\"非常严重超重\");
break;
}
break;
}
break;
}
break;
}
break;
}
}
}
求c#体重诊断代码,写完整点是计算BMI指数判断是否超重?
using System;
namespace ConseleZhidao
{
class p{
static void Main(string[] args){
float w,h;
Console.Write(\"体重(kg):\");
w=float.Parse(Console.ReadLine());
Console.Write(\"身高(m):\");
h=float.Parse(Console.ReadLine());
float bmi=w/h/h;
bmi=(float)Math.Round(bmi,2);
Console.Write(\"BMI指数:{0},\",bmi);
if (bmi<18.5) {
Console.WriteLine(\"过轻\");
}else if (bmi<24.99) {
Console.WriteLine(\"正常\");
}else if (bmi<28) {
Console.WriteLine(\"过重\");
}else if (bmi<32) {
Console.WriteLine(\"肥胖\");
}else {
Console.WriteLine(\"非常肥胖\");
【怎么用python算bmi 简单编程 在线等】}}}}


    特别声明:本站内容均来自网友提供或互联网,仅供参考,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。