String Pattern #1 in JAVA || BluejCode
String Pattern Program #1
String Pattern |
Program :-
import java.io.*;
import java.util.*;
class String_Pattern
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int i,j,l,a=0,b=0;
String str;
char ch;
System.out.println("Enter String");
str=in.nextLine();
l=str.length();
a=l;
for(i=0;i<l;i++)
{
a=l-i;
for(j=0;j<l;j++)
{
if(a==j)
{
ch=str.charAt(b);
System.out.print(ch+"\t");
a++;
b++;
}
else
{
ch=str.charAt(j);
System.out.print(ch+"\t");
}
}
System.out.println();
b=0;
}
} // end of main method
} // end of class
Comments
Post a Comment