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

Java Program for Triangle Part 1 :
package com.onlinetutorialspoint.patterns;
import java.util.Scanner;
public class Triangle_Down_LeftToRight {
    public static void main(String args[]) {
        /* Getting the input from keyboard */
        Scanner scanner = new Scanner(;
        System.out.println("Enter the size of Triangle..");
        int size = scanner.nextInt();
        for (int i = 1; i & lt; = size; i++) {
            for (int j = 1; j & lt; = size; j++) {
                if (j & lt; i) {
                    System.out.print(" ");
                } else {

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

Java Program for Triangle

Happy Learning 🙂

About the Author:

Founder of Love Java, Python, Shell and opensource frameworks. Follow him on twitter and facebook for latest updates.

Leave A Comment