/*输出9*9口诀。
1.程序分析:分行与列考虑,共9行9列,i控制行,j控制列。*/
public class Multiplication1 {
public static void main(String[]args){
int i;
int j;
System.out.println("段晋文的九九表:");
for(i = 1;i < 10;i++){
for(j = 1;j <= i;j++){
if(i * j < 10){
if(i == j){
System.out.print(j+" * "+i+" = "+j*i+" ");
System.out.println();
}else{
System.out.print(j+" * "+i+" = "+j*i+" ");
}
}else{
if(i == j){
System.out.print(j+" * "+i+" = "+j*i+" ");
System.out.println();
}else{
System.out.print(j+" * "+i+" = "+j*i+" ");
}
}
/*if(i == j){
System.out.print(j+" * "+i+" = "+j*i+" ");
System.out.println();
}else{
System.out.print(j+" * "+i+" = "+j*i+" ");
}*/
}
}
}
}
输出9*9口诀。
最新推荐文章于 2022-02-14 21:32:20 发布