290114lyp

导航

用for打印九九乘法表

package com.jiemo.struct;
public class ForShabi4 {
public static void main(String[] args) {
//1.先打印第一列
//2.把固定的i再用一个循环包起来
//3.去掉重复项,i<=j
//4.调整样式
for (int j = 0; j <= 9; j++) {
for (int i = 1; i <=j; i++) {
System.out.print(j+"*"+i+"="+(j*i)+"\t"); }
System.out.println();
} } }

posted on 2022-10-27 13:38  是芥末!日  阅读(11)  评论(0编辑  收藏  举报