Computer Applications
Answer
public class KboatStringPattern
{
public static void main(String args[]) {
String word = "ABCDE";
int len = word.length();
for (int i = 0; i < len; i++) {
for (int j = i; j < len; j++) {
char ch = word.charAt(j);
System.out.print(ch);
}
System.out.println();
}
}
}
Variable Description Table
Program Explanation
Output
Related Questions
Write a program to display the pattern:
A B C D E
A B C D A
A B C A B
A B A B C
A A B C DWrite a program to accept a word (say, BLUEJ) and display the pattern:
J
E E
U U U
L L L L
B B B B BWrite a program to accept a word (say, BLUEJ) and display the pattern:
B L U E J
L U E J
U E J
E J
JWrite a program to display the pattern:
A
B C
D E F
G H I J
K L M N O