www.3112.net > C语言BMI怎么算

C语言BMI怎么算

#include int main(){int b,c;printf("请输入体重(Kg)和身高(cm):\n");scanf("%d%d",&b,&c);printf("BMI:%0.2f\n",b/(c*c*0.0001));return 0;}

数据类型要用对: #includeint main(){ int weight=0; printf("请输入体重(kg):"); scanf("%d",&weight); double height=0;//////////double型 printf("请输入身高(m):"); scanf("%lf",&height);/////////%lf double BMI=(double)weight/(he...

#include int main( )printf("请输入 体重(千克)和身高(米):");scanf("%f%f",&w,&h);bmi=w/(h*h);printf("%.2f\n",bmi);return 0;}

wapbaike.baidu.com/view/.1,htm

代码语法倒是没什么错误,我查了下,体质指数(BMI)=体重(kg)÷身高^2(m)所以,代码改成BMI=weight/(height*height)。应该就是这样了~

可以参考下: #include int BMI(float n, float m);int main(){ float h, w; printf("输入身高:(m)\n"); scanf("%f", &h); printf("输入体重:(kgs)\n"); scanf("%f", &w); BMI(h, w); return 0;}int BMI(float height, float weight){ //体质...

18.5

数组一点用处都没有,为何要定义数组 #includeint main(){ int n,height, i; char sex; double weight, height_, BMI; scanf("%d\n", &n); for(i=0;i

#include int main(void) {double tz,sg,BMI;printf(" 请输入体重(kg):");scanf("%lf",&tz);printf(" 请输入身高(m):");scanf("%lf",&sg);BMI=tz/(sg*sg);printf("\n");if(BMI18.5 && BMI25 && BMI30 && BMI35)printf(" 非常肥胖\n");return 0...

if (18.5

网站地图

All rights reserved Powered by www.3112.net

copyright ©right 2010-2021。
www.3112.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com