public static void main(String[] args) {
for (int x = 1; x < 10; x++) {
for (int y = 1; y <= x; y++)
{
// 注意这里的制表符 列对齐
System.out.print(y + " * " + x + " = " + y * x + "\t");
}
System.out.println(); // 换行
}
结果:
![](https://img.haomeiwen.com/i7460111/45fbbb3d5b795000.png)
结果2(比对第一种方法,看看差异的原因在哪里):
![](https://img.haomeiwen.com/i7460111/f610796efcf8cf03.png)
网友评论