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