Java猜数字

package test1;
import java.util.*;

public class Demo {
public static void main(String[] args) {
int ex = (int) (Math.random()*100);
System.out.println(ex);
Scanner scan = new Scanner(System.in);
while(true) {
int in = scan.nextInt();
if(in==ex) {
System.out.println("Right!");
System.exit(0);
}
else {
System.out.println("Wrong!");
}

    }
    
}

}

猜你喜欢

转载自www.cnblogs.com/Archerme/p/10459658.html