import java.util.Scanner;
class Test1_GuessNum {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入一个数字,范围在:1-100之间");
int guessNum = (int)(Math.random()*100)+1;
while (true) {
int result = sc .nextInt();
if (result > guessNum) {
System.out.println("太大");
}else if (result < guessNum) {
System.out.println("太小");
}else{
System.out.println("二逗 你中了");
break ;
}
}
} |
|