Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

BlueJ Program on printing a word in a specific pattern


Printing any word in the following pattern:

child
hildc
ildch
ldchi
dchil
child


import java.io.*;
class Pat
{
int i,j,len;
String str;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
 public void take () throws Exception
 {
    System.out.print("\nTake the string:");
    str=br.readLine();
    len=str.length();
    for( i=0;i< len;i++)
    {
    for(j=0;j< len;j++)
    {
     System.out.print(str.charAt(j));
     }
     str=str.substring(1)+str.charAt(0);
     System.out.println();
     }
     System.out.println(str);
     }
   public static void main(String args[]) throws Exception
   {
    Pat object=new Pat();
    object.take();
    }
    }


This post first appeared on Tutorial Site On Computer Programming Languages F, please read the originial post: here

Share the post

BlueJ Program on printing a word in a specific pattern

×

Subscribe to Tutorial Site On Computer Programming Languages F

Get updates delivered right to your inbox!

Thank you for your subscription

×