小李今年18岁,身高172厘米,体重82.5公斤,效力是否属于肥胖呢?我们如何用程序描述?
#include<stdio.h>
void main()
{
int year=18;
double height=1.72;
double weight=82.5;
double BMI;
BMI=weight/(height*height);
if(BMI<18)
{
printf("偏瘦\n");
}
else if(BMI>18&&BMI<25)
{
printf("正常体重\n");
}
else
{
printf("偏重\n");
}
}
#include<stdio.h>
int main()
{
int age=18;
int height=172;
double weight=82.5;
char isfat='y';
printf(“”姓名:小李\n”);
printf(“年龄:%d\n”,age);
printf(“身高:%d\n”,height);
printf(“体重:f\n”,weight);
printf(“是否属于肥胖儿童:%c\n”,isfat);
return 0
}