Need to print pyramid in successive loop of number in JAVA

Asked By 0 points N/A Posted on -
qa-featured

I need a code to see a pyramidal structure create printed pressure entering the last full user. (I have an example of a completed below). I'm new to programming, i can enjoy, but stuck in this problem.

1

222222

33333 33333 33333

4444444 4444444 4444444 4444444

Everyone knows please help me.

SHARE
Answered By 0 points N/A #188027

Need to print pyramid in successive loop of number in JAVA

qa-featured

/*

        Java Pyramid 5 Example

        This Java Pyramid example shows how to generate pyramid or triangle like

        given below using for loop.

       

        12345

        1234

        123

        12

        1

 

*/

 

public class JavaPyramid5 {

 

        public static void main(String[] args) {

               

                for(int i=5; i>0 ;i–){

                       

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

                                System.out.print(j+1);

                        }

                       

                        System.out.println("");

                }

 

        }

}

 

/*

 

Output of the example would be

12345

1234

123

12

1

 

*/

 

 

Related Questions