Java Pattern Programs

Write a program in Java to display the following pattern:

A
AB
ABC
ABCD
ABCDE

Java

Java Nested for Loops

ICSE

22 Likes

Answer

public class KboatPattern
{
    public static void main(String args[]) {
        
        for (char i = 'A'; i <= 'E'; i++) {
            for (char j = 'A'; j <= i; j++) {
                System.out.print(j);
            }
            System.out.println();
        }
    }
}

Output

Answered By

9 Likes