Open roberthsu2003 opened 3 weeks ago
int main(void) { int kg; double m, BMI; printf("Please enter your weightin (kg):"); scanf("%d", &kg); printf("Please enter your Height in (cm):"); scanf("%lf", &m); BMI=(double)kg/(m/100*m/100); printf("Your BMI is :%.2lf\n", BMI); if (BMI<18.5){ printf("You are underweight"); }else if (BMI<24){ printf("You are Normal weight"); }else if (BMI<27){ printf("You are overweight"); }else if (BMI<30){ printf("You are light obse"); }else if(BMI<35){ printf("you ar Obsed"); }
return 0; }
// BMI值,體重範圍
#include <stdio.h>
#include <math.h>
int main(void) {
int weight,height;
double m,BMI;
printf("請輸入您的體重(kg):");
scanf("%d",&weight);
printf("請輸入您的身高(cm):");
scanf("%d",&height);
m=height/100.0;
BMI=weight/pow(m,2);
printf("您的BMI值為:%.2lf\n",BMI);
if(BMI<18.5){
printf("體重過輕\n");
}else if(BMI>=18.5&&BMI<24){
printf("正常範圍\n");
}else if(BMI>=24&&BMI<27){
printf("過重\n");
}else if(BMI>=27&&BMI<30){
printf("輕度肥胖\n");
}else if(BMI>=30&&BMI<35){
printf("中度肥胖\n");
}else if(BMI>=35){
printf("重度肥胖\n");
}
//=====================/|__/|
//====================(- w- )
return 0;
}
輸入
輸出