如何只使用一个循环输出99乘法表?


如何只使用一个循环输出如下的乘法表?

请输入图片描述

趣味

蛋蛋有桃桃 13 years, 1 month ago
   
  for(int i = 1; i <= 9 ; i++){
  
int j = 1;
if(i>=1){
System.out.print(j+"*"+i+"="+j * i +" ");
}
if(i>=2){
j++;
System.out.print(j+"*"+i+"="+j * i +" ");
}
if(i>=3){
j++;
System.out.print(j+"*"+i+"="+j * i +" ");
}
if(i>=4){
j++;
System.out.print(j+"*"+i+"="+j * i +" ");
}
if(i>=5){
j++;
System.out.print(j+"*"+i+"="+j * i +" ");
}
if(i>=6){
j++;
System.out.print(j+"*"+i+"="+j * i +" ");
}
if(i>=7){
j++;
System.out.print(j+"*"+i+"="+j * i +" ");
}
if(i>=8){
j++;
System.out.print(j+"*"+i+"="+j * i +" ");
}
if(i>=9){
j++;
System.out.print(j+"*"+i+"="+j * i +" ");
}
System.out.println();
}
}

嘻嘻frank answered 13 years, 1 month ago

Your Answer