Java Program for Basic Incrementing Triangle Pattern(Inverted)

Printing Basic Incrementing Triangle Pattern

In this program we’re going to code basic incrementing triangle pattern program

The logic of this program is this take any number input from user as row and col and store it in variable named as row and col and then run the for loop start from i=1 to i

Java Program for Basic incrementing Triangle Pattern(Inverted)

Printing Pattern:


  • Enter input from user row and col and take count=col-1
  • Take two loops one for each line (say ‘i’) and other for each digit in a particular line (say ‘j’). i starts from i=1 to i++ inside that take i loop start with j=1 to j++ inside that print count
  • After the end of main loop print System.out.println();

Code in Java:

import java.util.Scanner;
public class Pattern1 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(;
		System.out.println("Enter row and col");
		int row = sc.nextInt();
		int col = sc.nextInt();
		int count = col-1;
		for (int i = 1; i <= row; i++) {
			for (int j = 1; j <= i; j++)
This code is contributed by Shubham Nigam (Prepinsta Placement Cell Student)

One comment on “Java Program for Basic Incrementing Triangle Pattern(Inverted)”