Write a Java Program to print the following pattern:-
B
L L
U U U
E E E E
J J J J J
Answers
Answered by
3
import java.util.Scanner;
public class CharPattern2 {
public static void main(String[] args) {
System.out.println("Enter a String: ");
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
sc.close();
char [] a=s.toCharArray();
for (int i = 0; i < a.length; i++) {
for (int j = 0; j <= i; j++) {
System.out.print(a[j]);
}
System.out.println();
}
}
}
Answered by
1
Answer:
import java.util.*;
class print
{
public static void main (String args[ ])
{
System.out.println("B");
System.out.println("LL");
System.out.println("UU");
System.out.println("EEEE");
}
}
Please hit the like button if this helped you
Similar questions