# Ask the user to input the number of rows
num_rows = int(input("Enter the number of rows: "))

# Use nested loops to print the pattern
for i in range(1, num_rows + 1):
    for j in range(1, i + 1):
        print(j, end=" ")  # Print the numbers separated by spaces
    print()  # Move to the next line for a new row
