double func(double weight, double height)
{
double BMI = weight / (height * height);
if (BMI < 18.5)
{
printf("过轻\n");
}
else if (BMI < 25)
{
if (BMI < 20)
printf("正常\n");
else
printf("适中\n");
}
else if (BMI < 28)
...
else if (BMI < 32)
...
else
...
return BMI;
}