Computer Science, asked by maruruakshitha33, 7 months ago

Write a menu driven program for the patterns given:
Pattern 1:
1 2 3 4 5 6 7 8 9
2 3 4 5 6 7 8
3 4 5 6 7
4 5 6
5
4 5 6
3 4 5 6 7
2 3 4 5 6 7 8
1 2 3 4 5 6 7 8 9

Answers

Answered by kaurmanveer
2

Answer:

public class Main

{

public static void main(String[] args) {

    int count=1, c=4,b=6;

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

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

           System.out.print(j);

     }

     count++;

     System.out.println();

 }

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

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

            System.out.print(j);

        }

        c++;

        b++;

        System.out.println();

    }

}

}

Similar questions