Java Program to Print Inverted Right Triangle of Decreasing Order Numbers

Write a Java program to print the inverted right angled triangle of numbers in a decreasing order using for loop.

import java.util.Scanner;

public class InvertedRightTriDecreasing1 {
	
	private static Scanner sc;
	
	public static void main(String[] args) {
		
		sc = new Scanner(System.in);	
		
		System.out.print("Inverted Right Triangle of Descreasing Numbers Rows = ");
		int rows = sc.nextInt();
		
		System.out.println("Inverted Right Triangle of Numbers in Reverse Order");
		
		for (int i = rows ; i >= 1; i-- ) 
		{
			for (int j = i ; j >= 1; j-- ) 	
			{
				System.out.print(j + " ");
			}
			System.out.println();
		}
	}
}
Java Program to Print Inverted Right Triangle of Decreasing Order Numbers 1

This Java example print inverted right angled triangle number pattern of integers printing in decreasing order using a while loop.

import java.util.Scanner;

public class InvertedRightTriDecreasing2 {
	
	private static Scanner sc;
	
	public static void main(String[] args) {
		
		sc = new Scanner(System.in);	
		
		System.out.print("Inverted Right Triangle of Descreasing Numbers Rows = ");
		int rows = sc.nextInt();
		
		System.out.println("Inverted Right Triangle of Numbers in Reverse Order");
		int j, i = rows ;
		
		while (i >= 1 ) 
		{
			j = i ;
			while(j >= 1 ) 	
			{
				System.out.print(j + " ");
				j--;
			}
			System.out.println();
			i--;
		}
	}
}
Inverted Right Triangle of Descreasing Numbers Rows = 8
Inverted Right Triangle of Numbers in Reverse Order
8 7 6 5 4 3 2 1 
7 6 5 4 3 2 1 
6 5 4 3 2 1 
5 4 3 2 1 
4 3 2 1 
3 2 1 
2 1 
1 

Java Program to print inverted right angled triangle of decreasing order numbers using do while loop.

import java.util.Scanner;

public class InvertedRightTriDecreasing3 {
	
	private static Scanner sc;
	
	public static void main(String[] args) {
		
		sc = new Scanner(System.in);	
		
		System.out.print("Inverted Right Triangle of Descreasing Numbers Rows = ");
		int rows = sc.nextInt();
		
		System.out.println("Inverted Right Triangle of Numbers in Reverse Order");
		int j, i = rows ;
		
		do
		{
			j = i ;
			do 	
			{
				System.out.print(j + " ");

			} while(--j >= 1 );
			
			System.out.println();

		} while (--i >= 1 );
	}
}
Inverted Right Triangle of Descreasing Numbers Rows = 14
Inverted Right Triangle of Numbers in Reverse Order
14 13 12 11 10 9 8 7 6 5 4 3 2 1 
13 12 11 10 9 8 7 6 5 4 3 2 1 
12 11 10 9 8 7 6 5 4 3 2 1 
11 10 9 8 7 6 5 4 3 2 1 
10 9 8 7 6 5 4 3 2 1 
9 8 7 6 5 4 3 2 1 
8 7 6 5 4 3 2 1 
7 6 5 4 3 2 1 
6 5 4 3 2 1 
5 4 3 2 1 
4 3 2 1 
3 2 1 
2 1 
1