Thursday , September 21 2017
Home / Blue J / Java program for string in circular fashion.

Java program for string in circular fashion.

Write a program to input any string and output it in the following format: 

hello
elloh
llohe
lohel
ohell
 
class circularstring
{
public static void main(String args[])
{
String str=args[0],p,s="";
int i,j;
for(i=0;i<str.length();i++)
{
p=str.substring(i,l);
s=str.substring(0,i);
System.out.println(p+s);
}
}
}
OUTPUT:
 
hello
elloh
llohe
lohel
ohell
Tags: java program for circular string, bluej program for circulating the string in each line, program for string in round robin fashion.
 

Check Also

Program to check Upper Triangular matrix

What is Upper Triangular Matrix?  An upper triangular matrix is a square matrix in which ...

Leave a Reply

Your email address will not be published. Required fields are marked *