write a java program to print the following pattern.
55555
44444
33333
22222
1 1 1 1 1
Answers
Answer:
import java.util.Scanner;
public class KboatPatterns
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.println("Type 1 for Pattern 1");
System.out.println("Type 2 for Pattern 2");
System.out.print("Enter your choice: ");
int ch = in.nextInt();
switch (ch) {
case 1:
for (int i = 7; i >= 1; i -= 2) {
for (int j = 1; j <= i; j++) {
System.out.print(j);
}
System.out.println();
}
break;
case 2:
for (int i = 1; i <= 5; i++) {
for (int j = 1; j <= 5; j++) {
System.out.print(i);
}
System.out.println();
}
break;
default:
System.out.println("Incorrect Choice");
}
}
}
Explanation:
please make me brainliest please
Explanation:
bro pls mark me Brainleist