一行,输入一个人的体重(千克)和身高(米),中间用一个空格分隔。
一行,输出身体Normal(正常)或Abnormal(不正常)。
68 1.75
Normal
67.5 1.65
Abnormal
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"); } } }
#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; } |
#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; }
#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; }
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"); } }
#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"); }
#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; }