老师留了个99乘法表的作业,上三角的表,我很快就做出来了,但是下三角的代码怎么写呀,
请前辈们指点,
我想要这个问题的代码???

解决方案 »

  1.   


    package com.csdn.interview;public class ChengFaBiao {
        public  static void heng(){
    for(int i=1; i<=9; i++){
        for(int j=1; j<=i; j++){
    System.out.print(i+"x"+j+" ");
        }
        System.out.println("\n");
    }
        }
        
        public  static void shu(){
    for(int i=1; i<=9; i++){
        for(int j=1; j<=10-i; j++){
    System.out.print(i+"x"+j+" ");
        }
        System.out.println("\n");
    }
        }
        
        public static void main(String[] args) {
    heng();
    shu();
        }}
      

  2.   

    不对呀 ,
     public class mul
     {
       public static void main(String[] args)
       {
         int a, b;
         for (a=1;a<=9;a++)
         {
           for (b=1;b<=a;b++)
           {
             int c = a*b;
             System.out.print(b+"*"+a+"="+c+" ");
           }
           System.out.println();
         }
       }
     }
    这是上三角的,我要下三角的!!!
      

  3.   

    for(int i=1; i <=9; i++){ 
            for(int j=1; j <=10-i; j++){ 
            System.out.print(j+"*"+i+"="+j*i+" "); 
    }
    System.out.println();
    }
    这段代码添到main方法的后面!
      

  4.   

    下三角乘法表:public static void main(String[] args) {
    for (int i = 9; i > 0; i--) {
    for (int j = 1; j <= i; j++) {
    System.out.print(j + " * " + i + " = " + i * j);
    System.out.print("  ");
    }
    System.out.println();
    }
    }
      

  5.   

    public static void main(String[] args) {
    int i,j; for( i=1; i <=9; i++)

    for( j=1; j <=i; j++)

    System.out.print(j+"*"+i+"="+j*i+" "); 
    }
    System.out.println();
    }