write a menu driven program for both the patterns
please fast project Mai karna hai
I'll follow u and mark Brainliest
write in bluej language
Share
write a menu driven program for both the patterns
please fast project Mai karna hai
I'll follow u and mark Brainliest
write in bluej language
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Sample Program:
import java. util. *;
class brainly
{
public static void main(String args[])
{
System. out. println("Enter your choice : 1 (or) 2);
Scanner demo = new S canner(System. in);
int a = demo. nextInt();
System. out. println();
switch(a)
{
case 1:
int i,j;
for(i = 1; i <=5; i++)
{
for(j = 1; j<=5 - i + 1;j++)
{
System. out. print((char)(j+64));
}
System. out. println("");
}
break;
case 2:
String str="BLUEJ";
for(i = 0 ; i < str. length () - 1 ; i++)
{
for(j = str. length() ; j>i ; j--)
{
System. out. print("");
}
for(int k = 0; k <=i; k++)
{
System. out. print(str. charAt(i));
}
System. out. print("\n");
}
break;
default:
System. out. println("wrong choice");
}
}
}
Output:
Enter your choice: 1 (or) 2
1
ABCDE
ABCD
ABC
AB
A
Enter your choice: 1 (or) 2
2
B
LL
UUU
EEEE
Hope it helps!
Verified answer
B count 10 next letters you will get L
L count next 10 letters you will get U
U count next 10 letters you will get E
Continue counting and complete the pattern