的分段函数,要求输入x,计算出y的值,x

2025-04-29 11:57:00
推荐回答(1个)
回答1:

# include
int sign(int x)
{
if(x<0)return -1;
else if(x>0)return 1;
else return 0;
}
int main ()
{ int x;
scanf("%d",&x);
printf ("%d\n",sign(x));
system("pause");
return 0;
}