java代码
猜数字
public class Demo2 {
public static void main(String[] args){
Random r = new Random();
int number = r.nextInt(100)+1;//1~100
Scanner sc = new Scanner(System.in);
while(true){
System.out.println("请输入你猜的数");
int gues = sc.nextInt();
if(gues > number){
System.out.println("big");
}
if(gues < number){
System.out.println("small");
}
if(gues == number){
System.out.println("yse");
break;
}
}
}
}