编辑代码

#include<stdio.h>

int main(){
	char sex,diet;
	double fh,mh,h=0;
	int PE;
	printf("Boys(M) or girl(F):");
	scanf("%c",&sex);
	printf("\n");
	printf("Input father height(cm):");
	scanf("%d",&fh);
	printf("\n");
	printf("Input mother height(cm):");
	scanf("%d",&mh);
	printf("\n");
	printf("Do you like sports(3/2/1):");
	scanf("%d",&PE);
	printf("\n");
	printf("Do you have a good habit of diet(Y/N):");
	scanf("%c",&diet);
	printf("\n");
	
	if(sex=='M'||sex=='m'){
	h=(fh+mh)*0.54;
	}
	if(sex=='f'||sex=='F'){
	h=(fh*0.923+mh)/2;	
	}
	if(diet=='Y'||diet=='y'){
	h=h*1.015;
	}
	if(PE==3){
		h=h*1.02;
	}
	if(PE==2){
		h=h*1.01;
	}
	printf("Your future height will be %0.2lf",h);
	return 0;
}