比较麻烦的方法

TAN7 发表于 1年前 · 关联问题 体型判断

include<stdio.h>

int main() {

double t=0,w, h; scanf("%lf %lf", &h, &w); if (h >= 1 && h <= 2 && w >= 1 && w <= 200) { t = w / (h * h); if (t < 18) printf("underweight"); else if (t >= 18 && w / (h * h) < 25) printf("normal"); else if (t >= 25 && t < 27) printf("overweight"); else if(t>=27) printf("obese"); } return 0;

}