来自一位初学者的c语言if语句的问题。。。
#include<stdio.h>main()
{
int x,y;
printf("输入变量x:");
scanf("%d",&x);
if(x<2)
{if(x<1)
y=x+1;
else(1<=x<2);
y=x+2;}
else
{if(2<=x<3)
y=x+3;
else(x>=3);
y=x+4;}
printf("y的值为%d\n",y);
return 0;
}
为什么输入0的时候是2,怎样修改过来???
2017-10-21 20:35
2017-10-21 20:41
2017-10-21 20:42
2017-10-22 10:29