package p;
import java.lang.Math;
public class Suanshu {
public static void main(String[] args) {
int[] a = new int[30]; for (int i = 0; i < 30; i++) { int A = (int) (Math.random() * 100); int B = 1 + (int) (Math.random() * 100); int C = 1 + (int) (Math.random() * 4); if (C == 1) { System.out.println(A + "+" + B + "=?"); a[i] = A + B; } if (C == 2) { System.out.println(A + "-" + B + "=?"); a[i] = A - B; } if (C == 3) { System.out.println(A + "*" + B + "=?"); a[i] = A * B; } if (C == 4) { if (B != 0) { System.out.println(A + "/" + B + "=?"); a[i] = A / B; }}
} System.out.print("答案是"); for (int i = 0; i < 30; i++) { System.out.print(i+1 +"."+a[i]+" "); }}
}