Computer Science, asked by kapooralka2015, 7 months ago

Write a program in Java:​

Attachments:

Answers

Answered by ridhimakh1219
0

Write a program in Java:​

Explanation:

Program In Java to print Pattern

import java.util.Scanner;

public class Main

{

   public static void main(String[] args)

   {

       Scanner sc = new Scanner(System.in);

       //input number of rows

       System.out.println("Enter number of rows: ");

       int rows = sc.nextInt();

       System.out.println("Print Pattern....!!!");

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

       {

           for (int j = i; j >= 1; j--)

           {

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

           }            

           System.out.println();

       }

   }

}

Output

Enter number of rows:                                        

8                                

Print Pattern....!!!          

8 7 6 5 4 3 2 1                      

7 6 5 4 3 2 1                    

6 5 4 3 2 1                      

5 4 3 2 1                                

4 3 2 1  

3 2 1                                            

2 1                                                        

1  

Answered by anindyaadhikari13
5

<hr/>

Here is your code.

<hr/>

Attachments:
Similar questions