Computer Science, asked by pradipkumarmahatopm1, 1 day ago

Using the switch statement, write a menu driven program for the

following: ​

Attachments:

Answers

Answered by sharmilabanerjeeoct
2

Answer:

import java.util.*;

class menu

{

public static void main()

{

Scanner sc=new Scanner(System.in);

System.out.println("1.pattern1");

System.out.println("2.pattern");

System.out.println("enter the choice");

int ch=sc.nextInt();

switch(ch)

{

case 1:

int c=15;

for(int i=0;I<5;i++)

{

for(int j=5-i;j>0;j--)

{

System.out.print(c--+" ");

}

System.out.println();

}

break;

case 2:

for(int i=9;I>=1;i-=2)

{

for(int j=9;j>=I;j=j-2)

{

System.out.print(i);}

System.out.println();

}

break;

default:

System.out.println("wrong choice);

}}}

Similar questions