首页 > 试题广场 >

计算体重指数

[编程题]计算体重指数
  • 热度指数:46524 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32M,其他语言64M
  • 算法知识视频讲解

问题:计算BMI指数(身体质量指数)。BMI指数(即身体质量指数,简称体质指数又称体重,英文为Body Mass Index,简称BMI),是用体重公斤数除以身高米数平方得出的数字,是目前国际上常用的衡量人体胖瘦程度以及是否健康的一个标准。主要用于统计用途,当我们需要比较及分析一个人的体重对于不同高度的人所带来的健康影响时,BMI是一个中立而可靠的指标

数据范围:输入的数据满足


输入描述:
一行,两个整数,分别表示体重(公斤),身高(厘米),中间用一个空格分隔。


输出描述:
一行,BMI指数(保留两位小数)。
示例1

输入

70 170

输出

24.22
头像 云小逸0987
发表于 2022-04-21 16:24:19
方法一: ">int main(void) { int a = 0, b = 0; float c = 0; scanf("%d %d", &a, &b); c=(float)b / 100;//将b强制转化为float c *= c; 展开全文
头像 抓子
发表于 2023-02-13 01:08:52
#include <stdio.h> int main() { float height,weight; float BMI; scanf("%f %f",&weight,&height); BMI=weight/((height/100)*(heigh 展开全文
头像 青鱼29
发表于 2021-10-12 08:31:43
#include <stdio.h> int main() { int weight, high; scanf("%d %d", &weight, &high); double high_metre = high / 100.0 展开全文
头像 诗奕
发表于 2024-01-02 16:55:36
#include <stdio.h> int main() { int height=0; int weight=0; double BMI=0.0; scanf("%d %d",&weight,&height); 展开全文
头像 captain_fto
发表于 2021-12-19 00:00:08
数值计算 weight,height=input().split(" ") bmi=int(weight)/((int(height)/100)**2) print("{:.2f}".format(bmi))
头像 continue0608
发表于 2020-11-03 22:23:27
setprecision(n)是流格式控制符之一,在iomanip头文件中。 1.setprecision(n):限制位数例: double a = 3.1415926; cout << setprecision(2) << a; //输出结果为3.12.fixed+setp 展开全文
头像 fullofnewlife
发表于 2023-04-23 23:55:36
#include <stdio.h> int main() { int a, b; scanf("%d %d",&a,&b); float BMI=a/(b*b/10000.00); printf("%.2f",BMI); return 0; }
头像 牛客题解官
发表于 2020-06-04 16:25:54
分析: 题目简单,读入体重和身高带入公式计算即可得出结果,控制输出结果即可。 题解: #include <bits/stdc++.h> using namespace std; int main() { int weight = 0, height = 0; scanf 展开全文
头像 牛客193971283号
发表于 2022-04-08 13:46:19
#include <math.h> int main() { int a =0; int b =0; scanf("%d %d",&a,&b); float c =pow((1.0*b)/100,2); printf ("%.2f" 展开全文
头像 剑与行
发表于 2023-09-01 15:12:00
#include<stdio.h> int main() { int weight = 0; int height = 0; scanf("%d %d", &weight, &height); float BMI = 展开全文