/*
猜数字游戏
*/
import java.util.Scanner;
import java.util.Random;
public class Guesnum_game{
public static void main(String[] args){
Random ran = new Random();
int ranNumber = ran.nextInt(100)+1;
Scanner sc = new Scanner (System.in);
while(true){
int number = sc.nextInt();
if(ranNumber==number){
System.out.println("congratulation !!!");
break;
}else if(ranNumber > number){
System.out.println("sorry min again");
}else{
System.out.println("sorry max again");
}
}
}
}
java 猜数字小游戏
最新推荐文章于 2023-07-06 20:55:26 发布