import java.util.Scanner;
class GuessMath {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入一个整数");
int guessnum = (int)(Math.random()*100)+1;
while (true) {
int resule = sc.nextInt();
if (resule>guessnum) {
System.out.println("大了");
} else if (resule<guessnum) {
System.out.println("小了");
} else {
System.out.println("中了");
break;
}
}
}
}
|