标题: 智商测试,可以来试试 [打印本页] 作者: 0925李超月 时间: 2015-10-10 21:32 标题: 智商测试,可以来试试 import java.util.Scanner;
class Gem {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入数字");
int b = (int)(Math.random() * 100) + 1;
int count = 0;
while (true) {
int a = sc.nextInt();
if (a > b) {
System.out.println("大了");
}else if (a < b) {
System.out.println("小了");
}else if (a == b) {
System.out.println("中了");
break;
}
count++;