In this tutorials, we are going write a Java Program For Triangle Part 2 to create a below. This is a Part 2  of the complete example. You can follow the complete 4 parts to complete the entire example.

Java Program for Triangle Part- 2Java program for Triangle Part – 2 :


package com.onlinetutorialspoint.patterns;

import java.util.Scanner;

/*      
 *    j
 * i  *****
 *    ****
 *    ***
 *    **
 *    * 
 */
public class Triangle_Down_RightToLeft {
    public static void main(String args[]) {
        /* Getting the input from keybord */
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter the size of Triangle..");
        int size = scanner.nextInt();
        for (int i = 1; i <= size; i++) {
            for (int j = size; j >= i; j--) {
                System.out.print("*");
            }
            System.out.println();

        }
    }
}

By running the above Java program, you can get the below shape.

Output :

javac  Triangle_Down_RightToLeft.java
java  Triangle_Down_RightToLeft

Enter the size of Triangle..
10

**********
*********
********
*******
******
*****
****
***
**
*

Happy Learning 🙂