实现九九乘法表的输出
作业代码如下:
public class 输出九九乘法表作业 {
public static void main(String[] args) {
//外层循环 条件变量rows用来控制行数
for (int rows = 1; rows <= 9; rows++){
//内层循环 条件变量line用来控制列数
for (int line = 1; line <= rows; line++){
//循环打印输出
System.out.print(line+"x"+rows+"="+line*rows+"\t");
}
//换行
System.out.println();
}
}
}
作业代码运行如下: