
用最基础的c语言来编写该程序,有赏问答,有没有人帮帮忙啊,今天下午就要交了,希望有人可以回答

代码如下:
#include <stdio.h>
#include <math.h>
int main()
{
double x, y;
scanf("%lf", &x);
if (x < -2)
y = -x;
else if (x >= 2 && x < 6)
y = x * x + 3;
else if (x == 6)
y = 4;
else
y = sqrt(x);
printf("%lf", y);
return 0;
}