C程序问题!在线等!
展开全部
#include<stdio.h>
int main()
{
int i;
float weight=65.0;
float height=1.72;
float wgt_ratio;
printf("\n\t体重\t身高\t体重指数\n");
weight=weight-5.0;
for(i=0;i<10;i++)
{
wgt_ratio=weight/(height*height);
printf("\t%.1f\t%.2f\t%.1f\n",weight,height,wgt_ratio);
weight=weight+1.0;
}
return 0;
}
此程序完全符合题目要求,你可以运行试一试。
int main()
{
int i;
float weight=65.0;
float height=1.72;
float wgt_ratio;
printf("\n\t体重\t身高\t体重指数\n");
weight=weight-5.0;
for(i=0;i<10;i++)
{
wgt_ratio=weight/(height*height);
printf("\t%.1f\t%.2f\t%.1f\n",weight,height,wgt_ratio);
weight=weight+1.0;
}
return 0;
}
此程序完全符合题目要求,你可以运行试一试。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
# include <stdio.h>
int main()
{
float bmi = 0.0,height;//定义变量“身高”,”体重指数“
int weight;//”体重“
//bmi = weight / (height * height);
printf("请输入你的身高(米):");
scanf("%f",&height);
printf("\t体重(千克)身高(米)\t体重指数\n");
for (weight = 30 ; weight < 100 ; weight ++)//从10到50循环体重数
{
printf("\t%d\t%f\t%f",weight,height, weight / (height * height));//输出
if (weight / (height * height) > 18 && weight / (height * height) < 25)//在正常体重范围内
{
printf("\t您的体重正常!\n");
}
else if (weight / (height * height) > 25 && weight / (height * height) < 30)
{
printf("\t您超重了!\n");
}
else if (weight / (height * height) > 30)
{
printf("\t您轻度肥胖\n");
}
else if (weight / (height * height) > 35)
{
printf("\t 您中度肥胖!\n");
}
else if (weight / (height * height) < 18)
{
printf("\t您过轻!\n");
}
else
{
printf("\t您重度肥胖!");
}
}
return 0;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询