作业3-1 .输入一个整数 x,计算并输出下列分段函数 sign(x) 的值

#include<stdio.h>
int main(void)
{
    int y;
    double x;
    printf("Enter x:");
    scanf("%lf",&x);
    y=0;
    if(x>0)y=1;
    else if(x<0)y=-1;
    printf("y=%d",y);

    return 0;
}

原文地址:https://www.cnblogs.com/chengruiqiking/p/3385435.html