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

ICSE

54 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();
        }
    }
}

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

20 Likes