用一个for循环输出九九乘法表

java language

//一个for循环
for (int i = 1, j = 1; i <= 9 && j <= 9; ++i) {
    System.out.print(i + " * " + j + " = " + (i * j) + "\t");

    if (i == j) {
        i = 0;
        ++j;
        System.out.println();
    }
}

//两个for循环
for (int i = 1; i <= 9; ++i) {
    for (int j = 1; j <= i; ++j) {
        System.out.print(i + " * " + j + " = " + (i * j) + "\t");
    }
    System.out.println();
}