While:
class sixth_first {
public static void main(String[] args) {
int i = 1,j = 1;
int temp;
while(i != 10 && j != 10){
temp = j;
if(i <= j)
System.out.print(i + "*" + j + "=" + i*j + "\t");
i ++;
if(j < i){
System.out.println();
temp++;
i = 1;
j = temp;
}
}
}
}
Do-While:
class sixth_second {
public static void main(String[] args) {
int i = 1,j = 1;
int temp;
do{
temp = j;
if(i <= j)
System.out.print(i + "*" + j + "=" + i*j + "\t");
i ++;
if(j < i){
System.out.println();
temp++;
i = 1;
j = temp;
}
}while(i != 10 && j != 10);
}
}
结果如下: