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