程序自动生成10道(1-10之间的)加法题,每生成1道,就进行答题,10题答完,自动记分
```
public static void main(String[] args) {
int score = 0;
int num1 = 0;
int num2 = 0;
Random r = new Random();
Scanner sc = new Scanner(System.in);
for(int i=0; i<10; i++) {
num1 = r.nextInt(10) + 1;
num2 = r.nextInt(10) + 1;
int correctAnswer = num1 + num2;
System.out.println(num1 + " + " + num2 + " = ");
System.out.println("Please input the answer");
int input = sc.nextInt();
if(input == correctAnswer) {
score = score + 1;
}
}
System.out.println("Your total score is: " + score);
}
````