import java.util.Random; java
import java.util.Scanner; dom
public class Test class
{ import
public static void main(String[] args) 循環
{ System.out.println("我想了一個100之內的數,你猜猜"); im
Scanner scan=new Scanner (System.in); next
Random ran=new Random(); static
int b=ran.nextInt(100); di
int a=scan.nextInt(); while
while(a!=b)//循環條件
{
System.out.println("猜錯了");
if(a>b)
System.out.println("多了");
else
System.out.println("少了");
a=scan.nextInt();
}System.out.println("對了,我想的就是"+b);
}
}