打印九九乘法表,理解起来其实就是两个for循环;
代码如下:
public class JiuJiuChengFaBiao {
public static void main(String[] args) {
System.out.println("九九乘法表");
for (int i = 1; i <= 9; i++) {
for (int j = 1; j <=i ; j++) {
System.out.print(j+"*"+i+"="+j*i);
System.out.print(" ");
}
System.out.println();
}
}
}
运行结果截图: