fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. double height,weight,BMI;
  5. printf("请输入身高(m):");
  6. scanf("%1f",&height);
  7. printf("请输入您的体重(kg):");
  8. scanf("%1f",&weight);
  9. BMI=weight/(height*height);
  10. printf("您的BMI值=%.2f\n",BMI);
  11. if(BMI<18.5)
  12. printf("偏瘦\n");
  13. if(18.5<BMI<24.0)
  14. printf("正常\n");
  15. if(BMI>24.0)
  16. printf("偏重\n");
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 5280KB
stdin
1.6 52.0
stdout
请输入身高(m):请输入您的体重(kg):您的BMI值=inf
正常
偏重