for循环打印:
public class Chengfabiaofor {
public static void main(String[] args) {
// TODO Auto-generated method stub
//外面循环表示行
for (int i=1;i<=9;i++) {
//内循环表示每行的内容
for (int j = 1; j <=i; j++) {
System.out.print(j+"× "+i+"="+i*j+"\t");
}
System.out.print("\n");
}
}
}
do循环:
public class ChengFaBiaoDo {
public static void main(String[] args) {
int i=1;
do {
int j=1;
do {
System.out.print(j+"× "+i+"="+i*j+"\t");
j++;
} while (j<=i);
System.out.println();
i++;
} while (i<=9);
}
}
while循环:
public class ChengFaBiaowhile {
public static void main(String[] args) {
int i=1;
while (i<=9) {
int j=1;
while (j<=i) {
System.out.print(j+"× "+i+"="+i*j+"\t");
j++;
}
System.out.println();
i++;
}
}
}