KnowledgeBoat Logo

Java Pattern Programs

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

66 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

BlueJ output of Write a program to display the pattern: A B C D E F G H I J K L M N O

Answered By

22 Likes