#include<stdio.h>
int main(){
char sex,sports,diet;
int faHeight,moHeight,fuHeight;
float a=0;
float b=0;
printf("Are you a boy(M) or a girl(F)?");
scanf("%c",&sex);
printf("%c\n",sex);
printf("Please input your father's height(cm):");
scanf("%d",&faHeight);
printf("Please input your mother's height(cm):");
scanf("%d",&moHeight);
printf("Do you like sports(Y/N)?");
scanf("%c",&sports);
printf("Do you have a good habit of diet(Y/N)?");
scanf("%c",&diet);
if(sex=='M'){
fuHeight=(faHeight+moHeight) 0.54;
}else{
fuHeight=(faHeight * 0.923 + moHeight) / 2;
}
if(sports=='Y')
a=fuHeight0.02;
if(diet=='Y')
b=fuHeight*.015;
fuHeight+=(a+b);
printf("Your future height will be %d(cm)",fuHeight);
return 0;
}
scanf("%c",&sports);这句之前加一句 getchar();