第2个回答 2008-03-18
#include<stdio.h>
void main(){
int x,y;
printf("input x\n");
scanf("%d",&x);
if(x<10 && x >0)
y = x+1;
else if(x == 0)
y = x-1;
else if(x> -5 && x<0)
y = x;
printf("y=%d",x);
}
swith版的楼上已给出了大意,你可以自己编一下。
第5个回答 2019-11-04
很简单
#include<stdio.h>
void
main()
{
int
ix,iy;
printf("please
input
the
data
of
x:");
scanf("%d",&ix);
if(x<-5&&x>0)
printf("the
y
is
:%d",ix);
if(x==0)
{
iy=ix-1;
printf("the
y
is:%d"&iy);
}
if(x<0&&x<10)
printf("the
y
is:
1");
printf("input
any
key
to
quit!");
gech();
}
这是if的
#include<stdio.h>
void
main()
{
int
ix,iy,entrance;
printf("input
the
x:");
scanf("%d",ix);
if(x<-5&&x>0)
entrance=1;
if(x==0)
{
entrance=2;
}
if(x<0&&x<10)
entrance=3;
switch(entrance)
case
1:
printf("the
y
is
:%d",ix);break;
case
2:
printf("the
y
is
:%d,ix-1");break;
case
3:
printf("the
y
is
:
1");break;
printf("input
any
key
to
quit!");
getch();
}
就是这个了。