B
LL
UUU
EEEE
JJJJJ
import java.util.*;
public class strigpattern
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println("enter a string");
String n= sc.nextLine();
int a = n.length();
for(int i = 0;i<a;i++)
{
for(int j = 0;j<=i;j++)
{
char c = n.charAt(i);
System.out.print(c);
}
System.out.println("");
}
}
}
Output:
enter a string
BLUEJ
B
LL
UUU
EEEE
JJJJJ
No comments:
Post a Comment