用JAVA语言输出如 3 33 333,4 44 444 4444,以此类推

如题所述

public static void main(String[] args) {
int max = 8;

for (int i = 0; i < =max; i++) {

for (int j = 0; j < i; j++) {
for (int j2 = 0; j2 < j + 1; j2++) {
System.out.print(i);
}
System.out.print("    ");

}
System.out.println();

}
}


1    

2    22    

3    33    333    

4    44    444    4444    

5    55    555    5555    55555    

6    66    666    6666    66666    666666    

7    77    777    7777    77777    777777    7777777    

8    88    888    8888    88888    888888    8888888    88888888

温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-05-14
1,2 22,3 33 333,4 44 444 4444,5 55 555 5555 55555,6 66 666 6666 66666 666666
第2个回答  2017-05-14
package com.main;

public class A {

    /**
     * 
     * @param args
     */
    public static void main(String[] args) {
        int count=3;
        //int jishu = 3;
        for(int i=1;i<=3;i++)
        {
            for(int j=1;j<=count;j++)
            {
                if(j!=1)
                {
                    System.out.print(" ");
                }
                
                print(j, count);
            }
            if(i!=3)
            {
                System.out.print(",");
            }
            
            
            count++;
        }

    }
    public static void print(int count,int num)
    {
        for(int i=0;i<count;i++)
        {
            System.out.print(num);
        }
    }
    

}

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网