两种方法打印99乘法表

class test  
{
    public static void main (String[] args){
        //双循环
        for(int i=1;i<10;i++){  
            for(int a=1;a<=i;a++){  
                System.out.print(a+"*"+i+"="+a*i+"	"); 
            }
            System.out.println(); 
        }
           
        System.out.println("---------------------我是分割线-------------------------");
       
        //单循环
        for(int i=1,j=1;i<=9;j++){  
            System.out.print(j+"*"+i+"="+i*j+"	");  
            if (j==i){  
                i++;  
                j=0;  
                System.out.println();  
            }  
        } 
    }
}

  打印出来的效果是一样的

成功不是终点,失败也并非末日,重要的是前行的勇气!
原文地址:https://www.cnblogs.com/DSH-/p/9228199.html