Write a Java Program which will Print Inverted Right Angled Triangle shape |EasyCoding45

Write a Java Program that will Print Inverted Right Angled Triangle shape.


Printing patterns in Java is a common exercise for beginners to practice programming logic. You can use nested loops to control the structure of the pattern.

Program : (Write a Java Program that will Print an Inverted Right Angled Triangle shape)


public class InvertedRightAngledTriangle {

    public static void main(String[] args) {

        int rows = 5;


        for (int i = rows; i >= 1; i--) {

            for (int j = 1; j <= i; j++) {

                System.out.print("* ");

            }

            System.out.println();

        }

    }

}


Output : 

https://easycoding45.blogspot.com/2023/11/write-java-program-which-will-print_0188715586.html


Feel free to modify the number of rows (int rows = ...) in the examples to create patterns of different sizes. You can experiment with various patterns and use different symbols or characters to create more complex designs.

Comments