小学数学老师要求程序能自动生成300道四则运算题!!!!
public class Main {
public static void main(String[] ages) {
String[] operate = new String[]{"+", "-", "×", "÷"};
int[] numbers = new int[100];
for (int i = 1; i <= 100; i++) {
numbers[i - 1] = i;
}
Random r = new Random();
for (int i = 0; i < 300; i++){
System.out.println(numbers[r.nextInt(100)] + operate[r.nextInt(4)] + numbers[r.nextInt(100)] + "=");
}
}
}