KnowledgeBoat Logo

Computer Applications

Write a program in Java to display the following pattern:

PRTV
PRT
PR
P

Java

Java Library Classes

34 Likes

Answer

public class KboatPattern
{
    public static void main(String args[]) {
        for (int i = 86; i >= 80; i = i - 2) {
            for (int j = 80; j <= i; j = j + 2) {
                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: PRTV PRT PR P

Answered By

17 Likes


Related Questions