package nameyu;import java.util.Scanner;public class Test { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner input=new Scanner(System.in); int number1=(int)(Math.random()*99+1); int number2=(int)(Math.random()*99+1); //System.out.println(number1+" "+number2);测试两个数字是否显示是在1-100之间 System.out.println(number1+"+"+number2+"= ?"); int answer=input.nextInt(); if(number1+number2==answer){ System.out.println("You aer correct"); } else{ System.out.println("You answer is wrong"); System.out.println(number1+"+"+number2+"should be"+(number1+number2)); } } }
|