Write a Java Program which will print Right Angle Triangle Pattern. |EasyCoding45

Write a Java Program that will print the Right Angle Triangle Pattern.

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 which will print Right Angle Triangle Pattern.)


public class RightAngledTriangle {

    public static void main(String[] args) {

        int rows = 5;


        for (int i = 1; i <= rows; 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.html



Comments