public class class1 {public static void main(String[] args) {int x=2; int y; if(x<=0){ y=0; } if (x>0 &&x<=5){ y=2*x+1; } else{y=x*x-1;} System.out.println(y);}{int x = 2;int y;if (x<=0)System.out.println(0); switch(x){ case 1: case 2: case 3: case 4: case 5: {y= 2*x+1;} System.out.println(y); break; default: {y=x*x-1;} System.out.println(y); } }}
添加回答
举报
0/150
提交
取消