/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package something;
import java.util.List;
/**
*
* @author Sunshine
*/
public class Something {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
String input = "RaviKiran";
int index = 0;
for (int i = 1; ; i++) {
for (int j = 0; j < i; j++) {
try {
System.out.print(input.charAt(index));
} catch (StringIndexOutOfBoundsException ex) {
System.out.print("=");
}
index++;
}
System.out.println();
if (index >= input.length()) {
break;
}
}
}
}
OUTPUT
run:
R
av
iKi
ran=
BUILD SUCCESSFUL (total time: 0 seconds)
No comments:
Post a Comment