KnowledgeBoat Logo

Java Pattern Programs

Write a program in Java to display the following pattern:

ZYXWU
ZYXW
ZYX
ZY
Z

Java

Java Library Classes

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

Variable Description Table

Program Explanation

Output

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

Answered By

32 Likes