*/
Scanner sc = new Scanner(System.in);
System.out.println("请输入你要玩儿的游戏的编号,游戏如下:");
show();
int num = sc.nextInt();
System.out.println("你选择玩儿的是游戏是Game" + num);
switch (num) {
case 1:
System.out.println("请输入一个数字");
int i = sc.nextInt();
game1();
break;
case 2:
game2();
break;
case 3:
game3();
break;
case 4:
game4();
break;
case 5:
game5();
break;
case 6:
game6();
break;
public static void game1() {
Scanner sc = new Scanner(System.in);
System.out.println("请输入一个数字");
int n = sc.nextInt();
if (n>9||n<1) {
System.out.println("输入错误!");
}else {
for(int i=1;i<=n;i++) {
for(int j=1;j<=i;j++) {
System.out.print(j+"*"+i+"="+(i*j)+"\t");
}
System.out.println();
}
}
}
public static void game2() {
Scanner sc = new Scanner(System.in);
System.out.println("请输入第一个数字");
int i = sc.nextInt();
System.out.println("请输入第二个数字");
int j = sc.nextInt();
int sum = 0;
for (int x=(i<j?i:j);x<=(i>j?i:j);x++) {
sum += x;
}
System.out.println(sum);
}
public static void game3() {
Scanner sc = new Scanner(System.in);
System.out.println("请输入第一个数字");
int i = sc.nextInt();
System.out.println("请输入第二个数字");
int j = sc.nextInt();
i = i^j;
j = i^j;
i = i^j;
System.out.println("i = "+i+",j = "+j);
}
public static void game4() {
Scanner sc = new Scanner(System.in);
System.out.println("请输入第一个数字");
int i = sc.nextInt();
System.out.println("请输入第二个数字");
int j = sc.nextInt();
for (int x=1;x<=i;x++) {
for (int y=1;y<=x;y++){
System.out.print("*");
}
System.out.println();
}
for (int x=1;x<=j;x++) {
for (int y=j;y>=x;y--) {
System.out.print("*");
}
System.out.println();
}
}
public static void game5() {
Scanner sc = new Scanner(System.in);
System.out.println("请输入第一个数字");
int i = sc.nextInt();
System.out.println("请输入第二个数字");
int j = sc.nextInt();
int count = 0;
for (int x=(i<j?i:j);x<=(i>j?i:j);x++) {
if(x%2!=0&x<=(i>j?i:j)){
count++;
}
}
System.out.println("count = "+count);
}
public static void game6() {
Scanner sc = new Scanner(System.in);
System.out.println("请输入你最喜欢吃的水果");
String fruit = sc.next();
System.out.println("美女,这么巧啊,我也喜欢吃" + fruit );
}
}