改正一道C语言题
#include<stdio.h> void main()
{
int sex,diet,sport;
float hight,faHeight,moHeight;
char M,F,Y,N;
printf("please input sex,diet,sprot,faHeight,moHeight\n");
scanf("%c%c%c%f%f",&sex,&diet,&sport,&faHeight,&moHeight);
if(sex=='M')
{hight=(faHeight+moHeight)*0.54; }
else
if(sex=='F')
{ hight=(faHeight*0.923+moHeight)*0.5;}
if(diet=='Y')
{hight=hight*(0.015);}
else
if(diet=='N')
{printf("No add hight\n");}
if(sport=='Y')
{hight=hight*(0.02);}
else
if(sport=='N')
{printf("No add hight\n");}
printf("hight=%f",hight);
getch();
}输出结果是0的,为什么啊,高手指点下,这个结果不正确的。