๐ŸŽ‰ Special Offer !    Code: GET300OFF    Flat โ‚น300 OFF on every Java Course
Grab Deal ๐Ÿš€

Mirror Right Triangle Star Pattern Program in Java  


Program:
        *
      * *
    * * *
  * * * *
* * * * *
  • Below is the program:
    public class StarPattern4
    {
        public static void main(String[] args)
        {
            // Outer loop for number of rows
            for (int i=1; i<=5; i++)
            {
                // Inner loop for spaces in each row
                for(int j=4; j>=i; j--)
                {
                    System.out.print(" ");
                }
                // Inner loop for stars in each row
                for (int k=1; k<=i; k++)
                {
                    System.out.print("*");
                }
                // Move to the next line after printing stars in each row
                System.out.println();
            }
        }
    }