将以下 if 嵌套语句改写成 switch 语句

#include
int main() {
int x,y;
scanf("%d",&x);
if(x<5) {
    y=x;
    printf("x=%d, y=%d\n",x,y);
} else if(x<10) {
    y=2x-1;
    printf("x=%d, y=%d\n",x,y);
} else {
    y=3
x-11;
    printf("x=%d, y=%d\n",x,y);
}
return 0;
}

改不难,不过这样写判断是错误的,如果考虑负数的话应该改为x>=0&&x<5 x>=5&&x<10
switch (x){case x>=0&&x<5:...case x>=5&&x<10:...default:...}

switch语句后边只能接整数值,if表示的是范围型的,使用switch还得先用if或者switch 去先判断范围,再用switch语法