📜  java代码示例中的乘法表

📅  最后修改于: 2022-03-11 14:52:38.811000             🧑  作者: Mango

代码示例2
public static String multiTable(int num) {
        StringBuilder sb = new StringBuilder();

        for (int i = 1; i <= 10; i++) {
            int result = i * num;
            sb.append(i + " * " + num + " = " + result + "\n");
        }
        return sb.toString().trim();
    }