Computer Applications
Write a program to display the pattern:
A
B C
D E F
G H I J
K L M N O
Java
Java String Handling
67 Likes
Answer
public class KboatStringPattern
{
public static void main(String args[]) {
char ch = 'A';
for (int i = 0; i < 5; i++) {
for (int j = 0; j <= i; j++) {
System.out.print(ch++);
}
System.out.println();
}
}
}
Variable Description Table
Program Explanation
Output
Answered By
23 Likes
Related Questions
Write 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
B C D E
C D E
D E
EWrite 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 generate a triangle or an inverted triangle till n terms based upon the User’s choice of the triangle to be displayed.
Example 1:
Input: Type 1 for a triangle and
Type 2 for an inverted triangle
Enter your choice 1
Enter the number of terms 5
Sample Output:* * * * * * * * * * * * * * *
Example 2:
Input: Type 1 for a triangle and
Type 2 for an inverted triangle
Enter your choice 2
Enter the number of terms 5
Sample Output:A B C D E A B C D A B C A B A