There is a step function, write a program, input an x value, and require the corresponding y value to be output.

#include<stdio.h>  
 int main()
 {
     int x,y;
     printf("请输入x的值:");
     scanf("%d",&x);
     if(x<0)
         y=-1;
     else
         if(x==0)y=0;
         else y=1;
         printf("x=%d,y=%d\n",x,y);
         return 0;
 }

Guess you like

Origin blog.csdn.net/m0_64854963/article/details/122040885