修改程序清单3-1使之能产生三个一位数,然后提示用户输入这三个整数的和
import java.util.Scanner;
public class ThreeNumbers {
public static void main(String[] args) {
int number1 =(int)(System.currentTimeMillis() % 10 );
int number2 =(int)(System.currentTimeMillis() / 7 % 10 );
int number3 =(int)(System.currentTimeMillis() / 3 % 10);
//生成三个伪随机数
Scanner input = new Scanner(System.in);
System.out.println("what is " + number1 + "+" + number2 + " + " + number3 + " ? ");
int answer = input.nextInt();
System.out.println(number1 + "+" + number2 + "+" + number3 + "=" + answer + " is "
+ (number1+number2+number3 == answer));
}
}