C语言,数据类型与运算
【身高预测】
题目:
已知小明(男孩)爸爸的身高是175厘米,妈妈的身高是162厘米。小红(女孩)爸爸的身高是169厘米,妈妈的身高是153厘米,按照下面公式,预测并输出小明和小红的遗传身高(不考虑后天因素)。
男性成人时身高=(faHeight+moHeight)×0.54cm
女性成人时身高=(faHeight×0.923+moHeight)/2cm
以下为程序的运行结果示例:
Heightofxiaoming:181
Heightofxiaohong:154
输入格式:无
输出格式:
小明身高的输出式:“Heightofxiaoming:%d\n”
小红身高的输出格式:“Heightofxiaohong:%d\n”
#include <stdio.h>
int main ()
{
int m=(175+162)*0.54;
int w=(169*0.923+153)/2;
printf("height of xiao ming:%d\n",m);
printf("height of xiao hong:%d\n",w);
return 0;
}