Skip to content
Related Articles

Related Articles

Java Program to Print Downward Triangle Star Pattern
  • Last Updated : 17 Mar, 2021

Downward triangle star pattern means we want to print a triangle that is downward facing means base is upwards and by default, orientation is leftwards so the desired triangle to be printed should look like

* * * *
* * *
* *
*

Example

Java




// Java Program to Print Lower Star Triangle Pattern
  
// Main class
public class GFG {
  
    // Main driver method
    public static void main(String[] args)
    {
        // Nested 2 for loops for iteration over the matrix
  
        // Outer loop for rows
        int rows = 9;
        for (int a = rows - 1; a >= 0; a--) {
  
            // Inner loop for columns
            for (int b = 0; b <= a; b++) {
  
                // Prints star and space
                System.out.print("*"
                                 + " ");
            }
  
            // By now we are done with single row so new
            // line
            System.out.println();
        }
    }
}
Output
* * * * * * * * * 
* * * * * * * * 
* * * * * * * 
* * * * * * 
* * * * * 
* * * * 
* * * 
* * 
* 

Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :