输出:
1
1 2
1 2 3
1 2 3 4 
1 2 3 4 5
1 2 3 4 5 6(谢谢)

解决方案 »

  1.   


    public class Test {
    public static void main(String[] args) {
    for(int i = 1; i <= 6; i++) {
    for(int j = 1; j <= i; j++) {
    System.out.printf("%-3d",j);
    }
    System.out.println();
    }

    }
    }
      

  2.   

    用二位数组实现的,好想public class Print 
    {
    public static void main(String[] args) 
    {
    int[][] dataArray = new int[6][];
    for(int i=0; i<dataArray.length; i++){
    dataArray[i] = new int[i+1];
    }
    for(int i=0; i<dataArray.length; i++){
    for(int j=0; j<dataArray[i].length; j++){
    dataArray[i][j] = j+1;
    }
    } for(int i=0; i<dataArray.length; i++){
    for(int j=0; j<dataArray[i].length; j++){
    System.out.print(dataArray[i][j]+"  ");
    }
    System.out.println();
    }
    }
    }
      

  3.   

    public class Test {
        public static void main(String[] args) {
            System.out.println(1);
            System.out.println(1   2);
            System.out.println(1   2   3);
            System.out.println(1   2   3   4);
            System.out.println(1   2   3   4   5);
            System.out.println(1   2   3   4   5   6);
        
        }
    }
      

  4.   

    我发现2楼的
    System.out.printf("%-3d",j);

    System.out.print(j+" ");
    用起来来舒服哦
    c语言果然是个好东西啊
      

  5.   

    to fiore :
     你怎么没有幽默感呢?前面的几个都给出代码了,我给个稍微异样的代码不行啊?
    再说了,我的代码也符合LZ的要求阿,他又没规定什么。。搞得那么严肃干什么哦
      

  6.   

    public class P{
    private int line;//列
    private int rows;//行
    P(int l,int r){line=l;rows=r;}
    public void printnum(){
    for(int a=1;a<=line;a++){
    for(int b=1;b<=a;b++)
    System.out.print(b);
    System.out.println();}
    }
    public static void main(String [] args){
    P tmp= new P(6,6);
    tmp.printnum();
    }}
      

  7.   


    public class Printf {
        public static void main(String[] args) {
            for(int i = 1; i <= 6; i++) {
                for(int j = 1; j <= i; j++) {
                    System.out.print(i>j?j+" ": j+"\n");
                }
            }
            
        }
    }