问题:计算BMI指数(身体质量指数)。BMI指数(即身体质量指数,简称体质指数又称体重,英文为Body Mass Index,简称BMI),是用体重公斤数除以身高米数平方得出的数字,是目前国际上常用的衡量人体胖瘦程度以及是否健康的一个标准。主要用于统计用途,当我们需要比较及分析一个人的体重对于不同高度的人所带来的健康影响时,BMI值是一个中立而可靠的指标。
数据范围:输入的数据满足
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
double weight=scanner.nextDouble();
double height=scanner.nextDouble()/100;
double bmi=weight/(height*height);
System.out.println(String.format("%.2f",bmi));
}
}
#include <stdio.h>
int main() {
int weight=0;
int hight=0;
float BMI=0.0f;
scanf("%d %d",&weight,&hight);
BMI=weight/((hight/100.0)*(hight/100.0));
printf("%.2f\n",BMI);
return 0;
}