//这样写 #include<stdio.h> int main(){ int x,y; scanf("%d",&x); if(x<0){y=-1;} else if(x=0){y=0;} else{y=1;} printf("x=%d,Y=%d",x,y); return 0; }
如果是初学c语言,建议把该加的花括号都加上比如 if(){}