9.11

学到了编程的精义,编程思维:分解、模式识别、抽象、算法、单元测试、整合
回顾了random的使用


import java.util.Random;

public class Number {
public static void main(String[] args) {
Random random = new Random();

for (int i = 0; i < 30; i++) {
int n1 = random.nextInt(90) + 10;
int n2 = random.nextInt(90) + 10;
String[] operators = {"+", "-", "*", "/"};
String operator = operators[random.nextInt(4)];
String arithmeticExpression = n1 + " " + operator + " " + n2 + " = ";

System.out.println(arithmeticExpression);
}
}
}
posted @ 2023-09-11 21:30  涨涨涨张  阅读(4)  评论(0编辑  收藏  举报