Computer Science, asked by maneeshalucy657, 5 months ago

write its variable description... please

Write a menu driven program to display the pattern as per user’s choice.

Pattern 1

ABCDE

ABCD

ABC

AB

A

Pattern 2

B

LL

UUU

EEEE


HELP MEEEE

Answers

Answered by manojjangra2708
1

import java.io.*; import java.util.Scanner; class Pattern { public static void main(String args[]) throws IOException { Scanner sc = new Scanner(System.in); System.out.println(“::::MENU::::”) System.out.println(” 1. To display ABCD Pattern”); System.out.print(” 2. To display Word Pattern”); System.out.print(“Enter your choice:”); int ch= sc.nextlnt(); switch(ch) { case 1: for (char i = ‘E’; i > = ‘A’; i- -){ for(char j = ‘A’;j <=i;j + +){ System.out.print(j); } System.out.prindn( ); } break; case 2: String S = “BLUE”; for (int i = 0; i < S.length(); i+ +) { for(int j = 0; j < =i; j + +) { System.out.print(S.charAt(i)); } System.out.println(); } break; default: System.out.println(“Invalid Input”); break; Read more on Sarthaks.com - https://www.sarthaks.com/837421/write-a-menu-driven-program-to-display-the-pattern-as-per-users-choice

Similar questions