import java.util.Scanner;
class RandomDemo
{
public static void main(String[] args)
{ int num1 = (int)(Math.random()*100+1);
while(true) {Scanner sc = new Scanner(System.in);
int num2 = sc.nextInt();
if(num2>num1)
{
System.out.println("您输入的"+num2+"大了");
}
else if(num2<num1)
{
System.out.println("您输入的"+num2+"小了");
}
else
{
System.out.println("恭喜你,对了");
break;
}
//System.out.println(num1);
}
}
}
|
|