Closed roberthsu2003 closed 5 months ago
#include <stdio.h>
int main(void) {
double height, weight, BMI;
const char* message;
printf("請輸入身高(公分):");
scanf("%lf", &height);
printf("請輸入體重(公斤):");
scanf("%lf", &weight);
BMI = weight / ((height / 100) * (height / 100));
printf("您的BMI=%.2f\n", BMI);
if (BMI >=35)
{
message = "您的體重屬於重度肥胖";
}
else if (BMI >=30)
{
message = "您的體重屬於中度肥胖";
}
else if (BMI >=27)
{
message = "您的體重屬於輕度肥胖";
}
else if (BMI >=24)
{
message = "您的體重過重";
}
else if (BMI >=18.5)
{
message = "您的體重屬於正常範圍";
}
else
{
message = "您的體重過輕";
}
printf("%s\n",message);
return 0;
}
/*計算BMI值
請輸入身高(公分):
請輸入體重(公斤):
BMI值=體重/身高^2*/
/*檢查肥胖程度*/
#include <stdio.h>
int main(void) {
double W01, L01, Lm01, BMI01;
const char* BMI02;
printf("算BMI值\n");
printf("請輸入身高(公分)=");
scanf("%lf",&L01);
Lm01=L01/100;
printf("請輸入體重(公斤)=");
scanf("%lf",&W01);
BMI01=W01/Lm01/Lm01;
if (BMI01>=35){
BMI02="重度肥胖";
}else if(BMI01>=30){
BMI02="中度肥胖";
}else if(BMI01>=27){
BMI02="輕度肥胖";
}else if(BMI01>=24){
BMI02="過重";
}else if(BMI01>=18.5){
BMI02="正常範圍";
}else{
BMI02="過輕";
}
printf("BMI值=%.3lf",BMI01);
printf("%s\n",BMI02);
return 0;
}
#include <stdio.h>
#include <math.h>
int main(void) {
double Height;
double weight;
double BMI;
const char* message;
printf("Enter your height in meters:");
scanf("%lf", &Height);
printf("Enter your weight in kilograms:");
scanf("%lf", &weight);
BMI = weight / pow(Height/100 , 2);
printf("Your BMI is:%.2lf\n", BMI);
if(BMI >= 35){
message = "您的體重屬於重度肥胖";
}
else if (BMI >=30){
message = "您的體重屬於中度肥胖";
}
else if (BMI>=27){
message = "您的體重屬於輕度肥胖";
}
else if (BMI>=24){
message = "您的體重屬於過重";
}
else if (BMI>=18.5){
message = "您的體重正常";
}
else{
message = "您的體重過輕";
}
printf("%s\n",message);
return 0;
}
#include <stdio.h>
int main(void) {
double height, weight, BMI;
printf("請輸入身高(公分):");
scanf("%lf", &height);
printf("請輸入體重(公斤):");
scanf("%lf", &weight);
height= height/100;
BMI= weight/(height*height);
printf("BMI值為:%.3lf\n", BMI);
if (BMI<18.5){
printf("您的體重:過輕\n");
} else if (BMI<24){
printf("您的體重:正常\n");
} else if (BMI<27){
printf("您的體重:過重\n");
} else if (BMI<30){
printf("您的體重:輕度肥胖\n");
} else if (BMI<35){
printf("您的體重:中度肥胖\n");
} else
printf("您的體重:重度肥胖\n");
return 0;
}
#include <stdio.h>
int main(void) {
double height, weight, bmi;
const char * status;
printf("請輸入身高(公分):");
scanf("%lf", &height);
printf("請輸入體重(公斤):");
scanf("%lf",&weight);
height = height/100;
bmi = weight / (height * height);
if(bmi < 18.5){
status = "過輕";
}else if(bmi < 24){
status = "正常";
}else if(bmi < 27){
status = "過重";
}else if(bmi < 30){
status = "輕度肥胖";
}else if(bmi < 35){
status = "中度肥胖";
}else
status = "重度肥胖";
printf("您的BMI: %.2lf\n", bmi);
printf("您的體重:%s\n",status);
return 0;
}
#include <stdio.h>
int main(void) {
double height, weight, BMI;
const char* message;
printf("請輸入身高(公分):");
scanf("%lf", &height);
printf("請輸入體重(公斤):");
scanf("%lf", &weight);
height = height/100;
BMI = weight/(height*height);
printf("BMI值為:%.3lf\n", BMI);
if(BMI>=35){
message="您為重度肥胖";
}else if(BMI>=30){
message="您為中度肥胖";
}else if(BMI>=27){
message="您為輕度肥胖";
}else if(BMI>=24){
message="您的體重過重";
}else if(BMI>=18.5){
message="您的體重正常";
}else{
message="您的體重過輕";
}
printf("%s\n",message);
return 0;
}
/*請輸入身高(公分):
請輸入體重(公斤):
您的BMI:xxx.xxx
您的體重:正常*/
#include <stdio.h>
int main(void) {
double w;
double h;
double BMI;
const char *result;
printf("請輸入身高(公分):");
scanf("%lf", &h);
printf("請輸入體重(公斤):");
scanf("%lf", &w);
h = h/100;
BMI = w / (h*h);
printf("您的BMI:%.3lf\n",BMI);
if (BMI>=35){
result = "重度肥胖";
}else if (BMI>=30){
result = "中度肥胖";
}else if (BMI >=27){
result = "輕度肥胖";
}else if (BMI>=24){
result = "過重";
}else if (BMI >=18.5){
result = "正常";
}else{
result = "過輕";
}
printf("您的體重: %s\n", result);
return 0;
}
int main(void) {
double height, weight, BMI;
const char* message;
printf("請輸入身高(公分):");
scanf("%lf", &height);
printf("請輸入體重(公斤):");
scanf("%lf", &weight);
BMI = weight / ((height / 100) * (height / 100));
printf("您的BMI=%.2f\n", BMI);
if (BMI >=35)
{
message = "您的體重屬於重度肥胖";
}
else if (BMI >=30)
{
message = "您的體重屬於中度肥胖";
}
else if (BMI >=27)
{
message = "您的體重屬於輕度肥胖";
}
else if (BMI >=24)
{
message = "您的體重過重";
}
else if (BMI >=18.5)
{
message = "您的體重屬於正常範圍";
}
else
{
message = "您的體重過輕";
}
printf("%s\n",message);
return 0;
}
#include <stdio.h>
int main(void) {
double height,weight,BMI;
const char* message;
printf("請輸入身高(公分):");
scanf("%lf",&height);
printf("請輸入體重(公斤):");
scanf("%lf",&weight);
BMI=weight/((height/100)*(height/100));
printf("BMI值為:%.2lf\n", BMI);
if(BMI>=35){
message="您的體重「重度肥胖」";
}else if(BMI>=30){
message="您的體重「中度肥胖」";
}else if(BMI>=27){
message="您的體重「輕度肥胖」";
}else if(BMI>=24){
message="您的體重「過重」";
}else if(BMI>=18.5){
message="您的體重「正常範圍」";
}else{
message="您的體重「過輕」";
}
printf("%s\n", message);
return 0;
}
/*請輸入身高(公分):
請輸入體重(公斤):
您的BMI:xxx.xxx
您的體重:正常*/
#include <stdio.h>
int main(void) {
double h,w,BMI;
printf("請輸入身高(公分):");
scanf("%lf",&h);
printf("請輸入體重(公斤):");
scanf("%lf",&w);
BMI = w/((h/100)*(h/100));
printf("你的BMI為:%.2lf\n",BMI);
if(BMI>= 18.5 && BMI<24){
printf("您的體重正常");
}
else if(BMI>24){
printf("您的體重過重");
}
else {
printf("您的體重過輕");
}
return 0;
`