0
点赞
收藏
分享

微信扫一扫

根据父母身高预测儿子身高C语言代码

根据父母身高预测儿子身高C语言代码

#include <stdio.h> //预处理命令//
#define HEG 0.54//定义常量0.54//
float height(float father,float mother);

int main()
{
	float father;
	float mother;
	float son;

	printf("please input father's height:\n");
	scanf("%f",&father);

	printf("please input mother's height:\n");
	scanf("%f",&mother);

	son=height(father,mother);
	printf("caculate son's height:");
	printf("%.2f\n",son);
}

float height(float father,float mother)
{
	float son =(father+mother)*HEG;
		
		return son;
}

运行如下:
在这里插入图片描述

举报

相关推荐

0 条评论