#include <stdio.h>

int main() { int gender; double height, weight, standard_weight;

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

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

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

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

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

if (weight >= standard_weight * 0.9 && weight < standard_weight * 1.1) {
    printf("您的体重正常。\n");
} else if ((weight >= standard_weight * 0.8 && weight < standard_weight * 0.9) ||
           (weight >= standard_weight * 1.1 && weight < standard_weight * 1.2)) {
    printf("您的体重过轻或过重。\n");
} else if (weight < standard_weight * 0.8) {
    printf("您的体重严重不足。\n");
} else {
    printf("您的体重肥胖。\n");
}

return 0;

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

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