#include
#include
int main()
{ double x,y;
scanf("%lf",&x);
if(x>6)
y=5/27*(pow(x,2)+4*x-6);
else if(06)
y=(log(16)/log(3))+x;
else
y=23/7*(fabs(pow(x,3)+4));
printf("%.3lf",y);
return 0;
}
你这个 5/27 直接=0了啊,0*什么都是0 ,得把他整成小数才行
#include<stdio.h>
#include<math.h>
int main()
{
double x, y;
scanf("%lf", &x);
if (x > 6)
y = double(5) / 27 * (pow(x, 2) + 4 * x - 6);
else if (0 < x && x <= 6)
y = (log(16) / log(3)) + x;
else
y = double(23) / 7 * (fabs(pow(x, 3) + 4));
printf("%.3lf", y);
return 0;
}