Downward Triangle Star Pattern in Java

thumbnail

In this tutorial, you will learn to create downward trianle star pattern in java.

Example 1:

package patternchallenge;
public class PatternChallenge {
    public static void main(String[] args) {
        downwardTriangle1 (5);
    } 
    
    public static void downwardTriangle1(int n){ 
        for(int i=n-1; i>=0; i--){   
            for(int j=0; j<=i; j++){       
                System.out.print("*"); // print star
            }           
            System.out.println(); 
        } 
    }
}

The output will be:

*****
****
***
**
*
Back To Top