Computer Science, asked by Student42280, 9 months ago

using switch case statement write a menu driven program to do the following
a) to generate and print letters from A to Z and their Unicode.
b) display the following pattern using iterations looping statements.

this is the question and I have solved it but I am getting 1 error pls rectify it. ​

Attachments:

Answers

Answered by Tigresses
38

Answer:

1). To generate and print Letters from A to Z and their Unicode

Letters Unicode

A 65

B 66

Z 90

2) Display the following pattern using iteration (looping) statement.

1

12

123

1234

12345

code

import java.util.*;

class Question5 {

public static void main(String args[]) {

Scanner in = new Scanner(System.in);

System.out.println("Choose an Option :");

System.out.println("1. To generate and print Letters from A to Z and their Unicode");

System.out.println("2. Display a Number Pattern.");

int ch = in.nextInt();

switch(ch) {

case 1:

System.out.println("Letters\tUnicode");

for(int i=65;i<=90;i++) {

System.out.println((char)i+"\t"+i);

}

break;

case 2:

for(int i=1;i<=5;i++) {

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

System.out.print(j);

}

System.out.println("\n");

}

}

}

}

Similar questions