#include <stdio.h>

int main() { char gender; int height; float weight, standard_weight;

printf("请输入您的性别(男/女):");
scanf("%c", &gender);

printf("请输入您的身高(cm):");
scanf("%d", &height);

printf("请输入您的实际体重(kg):");
scanf("%f", &weight);

if (gender == '男') {
    standard_weight = (height - 80) * 0.7;
} else if (gender == '女') {
    standard_weight = (height - 70) * 0.6;
} else {
    printf("性别输入有误!\n");
    return 0;
}

printf("您的标准体重为:%.2fkg\n", standard_weight);

float diff = weight - standard_weight;
float percent = diff / standard_weight * 100;

if (percent >= -10 && percent < 10) {
    printf("您的体重正常。\n");
} else if (percent >= -20 && percent < -10) {
    printf("您的体重过轻。\n");
} else if (percent >= 10 && percent < 20) {
    printf("您的体重过重。\n");
} else if (percent < -20) {
    printf("您的体重严重不足。\n");
} else if (percent >= 20) {
    printf("您的体重肥胖。\n");
}

return 0;

}

C语言实现世界卫生组织标准体重计算器

原文地址: https://www.cveoy.top/t/topic/kFCS 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录