Java program to Print Reverse Right Angle Triangle with numbers


Following java program builds Reverse Right Angle Triangle pattern with numbers using for loop

public class Pattern14 {
  public static void main(String[] args) {
    int i, j, rows = 9;
    for (i = rows; i >= 1; i--) {
      for (j = 1; j <= i; j++) {
        System.out.print(j + " ");
      }
      System.out.println();
    }
  }
}

Output:

1 2 3 4 5 6 7 8 9 
1 2 3 4 5 6 7 8 
1 2 3 4 5 6 7 
1 2 3 4 5 6 
1 2 3 4 5 
1 2 3 4 
1 2 3 
1 2 
1 

Try it Online here https://onecompiler.com/java/3x73a8psx