Write a Python program to print triangle of numbers in reverse pattern using for loop.
rows = int(input("Enter Triangle Reverse Numbers Pattern Rows = ")) print("====The Triangle of Numbers in Reverse Pattern====") for i in range(rows, 0, -1): for j in range(1, i): print(end = ' ') for k in range(i, rows + 1): print(k, end = ' ') print()
This Python example prints the triangle pattern of numbers in descending order or reverse order using a while loop.
rows = int(input("Enter Rows = ")) print("====The Triangle of Numbers in Reverse Pattern====") i = rows while(i >= 1): j = 1 while(j < i): print(end = ' ') j = j + 1 k = i while(k <= rows): print(k, end = ' ') k = k + 1 print() i = i - 1
Enter Rows = 9
====The Triangle of Numbers in Reverse Pattern====
9
8 9
7 8 9
6 7 8 9
5 6 7 8 9
4 5 6 7 8 9
3 4 5 6 7 8 9
2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9