今天的作业 多联系几次
import java.util.Scanner;
class Demo_Random
{
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 getNum=sc.nextInt();
if (getNum>guessNum){
System.out.println("你猜的数字太大了");
}else if (getNum<guessNum){
System.out.println("你猜的数字太小了");
} else
System.out.println("恭喜你猜中了");
}
}
} |
|