C语言编程问题,初学者,麻烦简单些,谢谢(*°∀°)=3?
世卫计算方法:
男性:(身高cm-80)×70﹪=标准体重 女性:(身高cm-70)×60﹪=标准体重
标准体重正负10﹪为正常体重
标准体重正负10﹪~ 20﹪为体重过重或过轻
标准体重正负20﹪以上为肥胖或体重不足 展开
#include "stdio.h"
int main()
{
int sex,height;
float weight,bzweight;//输入体重和标准体重
printf("输入性别(0-男性,1-女性):");
scanf("%d",&sex);
printf("输入身高(cm):");
scanf("%d",&height);
printf("输入体重(kg):");
scanf("%f",&weight);
if(sex==0)
bzweight=(height-80)*0.7;
else
bzweight=(height-70)*0.6;
if(((weight-bzweight)/weight>=-0.1)&&((weight-bzweight)/weight<=0.1))
printf("正常体重\n");
else if(((weight-bzweight)/weight>0.1)&&((weight-bzweight)/weight<=0.2))
printf("体重过重\n");
else if(((weight-bzweight)/weight>-0.2)&&((weight-bzweight)/weight<-0.1))
printf("体重过轻\n");
else if((weight-bzweight)/weight>0.2)
printf("肥胖\n");
else if((weight-bzweight)/weight<=-0.2)
printf("体重不足\n");
printf("%.2f\n",(weight-bzweight)/weight);
return 0;
}