#include <stdio.h>
#include <stdlib.h>
int main()
{
char gender;
int h,s;
printf("Please enter your gender(m/w):\n");
scanf("%c",&gender);
if(gender=='m')
{
printf("Please input height(cm):\n");
scanf("%d",&h);
s=(h-80)*0.7;
printf("The standard weight is:%d",s);
}
else if(gender=='w')
{
printf("Please input height(cm):\n");
scanf("%d%d",&h);
s=(h-70)*0.6;
printf("The standard weight is:%d",s);
}
else
{
printf("Please enter your gender(m/w):");
}
return 0;
//男:(身高/cm-80)*0.7/KG=标准体重;
//女:(身高/cm-70)*0.6/KG=标准体重
}
C语言判断标准体重
最新推荐文章于 2024-04-23 21:04:50 发布