KnowledgeBoat Logo

Java Pattern Programs

Write a program in Java to display the following pattern:

ZYXWU
ZYXW
ZYX
ZY
Z

Java

Java Library Classes

ICSE

62 Likes

Answer

public class KboatPattern
{
    public static void main(String args[]) {
        for (int i = 86; i <= 90; i++) {
            for (int j = 90; j >= i; j--) {
                System.out.print((char)j);
            }
            System.out.println();
        }
    }
}

Output

BlueJ output of Write a program in Java to display the following pattern: ZYXWU ZYXW ZYX ZY Z

Answered By

25 Likes