Print the pattern

take user input for the number of rows.

Example: n=5

Output:

1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

1 Like

n=int(input(“Enter the number of rows is :”))
for i in range(n,1,-1):
for j in range(1,i):
print(j,end=" ")
print()

1 Like

rows = 5
for i in range(rows, 0, -1):
for j in range(1, i + 1):
print(j, end=’ ')
print(“\r”)

1 Like

r = int(input(“Enter the number”))
for i in range(r,0,-1):
for j in range(1, i+1):
print(j, end=" “)
print(”\n")