Computer Science, asked by mrunknown567, 3 days ago

Write a program to display the battern for class 9 Ie SE in java 6 56 4 5 6 3456 23456 1 2 3 4 5 6​

Answers

Answered by anindyaadhikari13
2

Correct Question:

Write a program to display the pattern.

6  

5 6  

4 5 6  

3 4 5 6  

2 3 4 5 6  

1 2 3 4 5 6

Solution:

The given problem is solved in Java.

public class Main{

   public static void main(String args[]){

       int i, j, n = 6;

       for(i = n; i > 0;i--){

           for(j = i;j <= n;j++)

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

           System.out.println();

       }

   }

}

Output:

6  

5 6  

4 5 6  

3 4 5 6  

2 3 4 5 6  

1 2 3 4 5 6

Refer to the attachment for verification.

Attachments:
Similar questions