import java.util.Scanner;
class MathGame
{
public static void main(String[] args)
{
int number = (int)(Math.random()*100+1);
System.out.println("请输入一个数");
while (true)
{
Scanner s=new Scanner(System.in);
int getnumber=s.nextInt();
if (getnumber>number)
{
System.out.println("您输入的数"+getnumber+"大了");
}
else if (getnumber<number)
{
System.out.println("您输入的数"+getnumber+"小了");
}
else
{
System.out.println("恭喜你中奖了,去杜树鹏处领取2卡");
break;
}
}
}
}
|
|