package hello;
import java.util.Scanner;
public class Hello {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int number;
int count=0;
int a;
number=(int)(Math.random()*100+1); //1到100的随机值;
do
{
a=in.nextInt();
count ++;
if(a>number)
{
System.out.println("偏大啦");
}
else if(a<number)
{
System.out.println("偏小啦");
}
}while(a!=number);
System.out.print("猜对啦,猜了"+count+"次喔");
}
}
猜数游戏
最新推荐文章于 2023-11-29 15:29:59 发布