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