Computer Science, asked by sujayG17, 11 months ago

WAP in Java to give this number pattern:-
1 2 3 4 5
5 4 3 2
2 3 4
4 3
3​

Answers

Answered by rushilansari
0

ANSWER:

PLS MARK THE BRAINLIEST..................

public class Pattern {

   public static void main(String[] args) {

       int rows = 5;

       for(int i = rows; i >= 1; --i) {

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

               System.out.print(j + " ");

           }

           System.out.println();

       }

   }

}

OUTPUT:

1 2 3 4 5

1 2 3 4  

1 2 3

1 2

1

you can input your number instead of this

Similar questions