#include<stdio.h>
int fun(int x)
{
/根据x的值返回对应的y值/
if(x<0)
return -1;
else
if(x==0)
return 0;
else
return 1;
}
main ()
{
int x,y;
printf("enter x:");
scanf("%d",&x);
y=fun(x);
printf("x=%d,y=%d\n",x,y);
return 0;
}
#include<stdio.h>
int fun(int x)
{
/根据x的值返回对应的y值/
if(x<0)
return -1;
else
if(x==0)
return 0;
else
return 1;
}
main ()
{
int x,y;
printf("enter x:");
scanf("%d",&x);
y=fun(x);
printf("x=%d,y=%d\n",x,y);
return 0;
}