请问我的计算结果为什么是138.00000而不是138.80000
#include <stdio.h>
int main()
{
float spend;
spend=cost(12, 9 ,18);
printf("%f",spend);
return 0;
}
float cost(int x ,int y1, int y2)
{
float sum=0.0;
if(x<=3)
{
sum=(13+1)*4;
}
else if((y1>=23||y1<5)&(y2>=23||y2<5))
{
sum=(14+(x-3)*2.3*1.2)*4;
}
else if((y2>=23||y2<5)&(y1>=23||y1<5))
{
sum=(14+(x-3)*2.3)*2+(14+(x-3)*2.3*1.2)*2;
}
else if((y1>=23||y1<5)&(y2>=23||y2<5))
{
sum=(14+(x-3)*2.3)*2+(14+(x-3)*2.3*1.2)*2;
}
else
{
sum=(14+(x-3)*2.3)*4;
}
return sum;
}