首页 > 试题广场 >

健康评估

[编程题]健康评估
  • 热度指数:32693 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 256M,其他语言512M
  • 算法知识视频讲解
BMI指数(即身体质量指数)是用体重公斤数除以身高米数平方得出的数字,是目前国际上常用的衡量人体胖瘦程度以及是否健康的一个标准。例如:一个人的身高为1.75米,体重为68千克,他的BMI=68/(1.75^2)=22.2(千克/米^2)。当BMI指数为18.5~23.9时属正常,否则表示身体存在健康风险。编程判断人体健康情况。

输入描述:
一行,输入一个人的体重(千克)和身高(米),中间用一个空格分隔。


输出描述:
一行,输出身体Normal(正常)或Abnormal(不正常)。
示例1

输入

68 1.75

输出

Normal
示例2

输入

67.5 1.65

输出

Abnormal
#include<stdio.h>
int main() {
    double w,h,bmi;
    scanf("%lf %lf",&w,&h);
    bmi = w/(h*h);
    printf("%s",(bmi>=18.5&&bmi<=23.9)?"Normal":"Abnormal");
}

发表于 2021-08-31 23:55:51 回复(0)
#include<stdio.h>
#include<math.h>    //pow(x,y) 求x的y次方
int main(){
    float weight,height,BMI;
    scanf("%f %f",&weight,&height);
    BMI=weight/pow(height,2);
    if(BMI >= 18.5 && BMI <= 23.9) printf("Normal");
    else printf("Abnormal");
    return 0;
}
发表于 2022-06-12 09:15:23 回复(0)
#include<iostream>
using namespace std;

int main()
{
    double n, m;
    cin >> n >> m;
    double bmi = n / (m * m);
    if (bmi <= 23.9 && bmi >= 18.5) cout << "Normal" << endl;
    else cout << "Abnormal" << endl;
}

发表于 2022-02-26 14:08:27 回复(0)
#include<stdio.h>
#include<math.h>

int main()
{
    float a,b,B;
    scanf("%f%f",&a,&b);
    B=a/pow(b,2);
    if(B>=18.5&&B<=23.9)
        printf("Normal");
    else
        printf("Abnormal");
    return 0;
}

发表于 2021-07-07 15:19:31 回复(0)
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double w =sc.nextDouble();
        double h =sc.nextDouble();
        double bml=w/(h*h);
        if(bml>=18.5&&bml<=23.9){
            System.out.println("Normal");

        }
        else{
            System.out.println("Abnormal");
        }

    }
}

发表于 2020-04-29 11:30:47 回复(0)
#include<iostream>
usingnamespacestd;
intmain()
{
    doubleweight,height;
    cin>>weight>>height;
   doublebmi=weight/(height*height);
   if(bmi>=18.5&&bmi<=23.9) cout<<"Normal"<<endl;
   elsecout<<"Abnormal"<<endl;
}
发表于 2020-03-06 19:48:28 回复(0)
哪个大神帮我看看这个怎么不对
#include <stdio.h>
int main() {
    int sg=0;
    int tz=0;
 scanf("%c %c",&sg,&tz);
 if(tz/(sg*sg)>=18.5&&tz/(sg*sg)<=23.9){
    printf("Normal");
    }
else {
    printf("Abnormal");
}
    return 0;
}

发表于 2023-10-15 22:24:26 回复(2)
a,b=map(float,input().split())
c=a/(b*b)
if c>=18.5 and c<=23.9:
    print('Normal')
else:
    print('Abnormal')
发表于 今天 09:27:45 回复(0)
#include <stdio.h>

int main() {
    double a, b;
    scanf("%lf %lf", &a, &b);
    if (a / b / b  >= 18.5 && a / b / b <= 23.9) {

        printf("Normal\n");
    } else {
        printf("Abnormal\n");
    }

    return 0;
}

发表于 2024-10-03 21:40:05 回复(0)
wkg,hme = list(map(float,input().split()))
try:
    BMI = wkg/pow(hme,2)  # 身体质量指数
    if   18.5 <= BMI <= 23.9:
        print("Normal")
    else:
        print("Abnormal")
except:
    print('输入有误')


发表于 2024-09-25 12:39:20 回复(0)
#include <stdio.h>

int main() {
   float w,h,BMI;
   scanf("%f %f",&w,&h);
  BMI=w/(h*h);
  if(18.5<=BMI&&BMI<=23.9)
  {
    printf("Normal");
  }
  else{
    printf("Abnormal");
  }
    return 0;
}

发表于 2024-09-24 21:02:00 回复(0)
int main() {
    double a, b;
    scanf("%lf %lf", &a, &b);
    double bmi = a / (b * b);
    18.5 <= bmi && bmi <= 23.9 ? printf("Normal") : printf("Abnormal");
    //  1<3<2 => (1<3)<2 => 1<2 
    return 0;
}

发表于 2024-08-01 15:26:01 回复(0)
public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        double weight = in.nextDouble();
        double height = in.nextDouble();
        
        double bmi = weight/(Math.pow(height,2));
        
        if (bmi >= 18.5 && bmi <= 23.9){
            System.out.println("Normal");
        } else {
            System.out.println("Abnormal");
        }
    }

发表于 2024-07-30 16:42:10 回复(0)
#include <iostream>
using namespace std;

int main() 
{
    float a, b;
    cin >> a >> b;
    int ret = a / (b * b);
    if (ret > 18.5 && ret <= 23.9) 
        cout << "Normal" << endl;
    else 
        cout << "Abnormal" << endl;
    return 0;

}

发表于 2024-05-02 19:57:05 回复(0)
#include <stdio.h>

int main() 
{
    double w = 0, h = 0;
    scanf("%lf %lf", &w, &h);
    double BIM = w / (h * h) ;
    if(BIM >= 18.5 && BIM <= 23.9)
        printf("Normal");
    else
        printf("Abnormal");
}

注意不能写成   18.5 <= BIM <= 23.9,当BIM大于23.9也会为真

发表于 2024-04-15 23:55:29 回复(0)
发表于 2024-03-26 15:53:48 回复(0)
#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <math.h>

int main()
{
    float height = 0;
    float weight = 0;
    float bmi = 0.0f;

    scanf("%f%f", &weight, &height);

    bmi = weight / pow((double)height, 2);

    if (bmi <= 23.9 && bmi >= 18.5)
    {
        printf("Normal\n");
    }
    else
    {
        printf("Abnormal\n");
    }

    return 0;
}

编辑于 2024-03-18 16:28:11 回复(0)
#include <stdio.h>
#include <math.h>

int main() {
    float weight, height;
    scanf("%f %f", &weight, &height);
    printf("%s", (weight/pow(height,2))>=18.5&&(weight/pow(height,2))<=23.9?"Normal":"Abnormal");
    return 0;
}
发表于 2024-01-13 12:40:05 回复(0)
package main

import (
    "fmt"
)

func main() {
    var w,h float64
    fmt.Scan(&w,&h)
    bmi := w/(h*h)
    if bmi < 18.5 || bmi > 23.9 {
        fmt.Println("Abnormal")
    } else {
        fmt.Println("Normal")
    }
}
发表于 2023-12-17 20:05:07 回复(0)
#include <stdio.h>

int main()
{
    float a,b;
    scanf("%f %f",&a,&b);
    if(a/(b*b)>=18.5&&a/(b*b)<=23.9)
    {
        printf("Normal");
    }
    else 
    {
        printf("Abnormal");
    }
    return 0;
}

发表于 2023-11-04 21:06:02 回复(0)