Write a program to display the given pattern:
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Answers
Answered by
2
Input :
# 5 is the total number to print.
for num in range(1,6): # for loop for the row.
for i in range(num): # for loop for the column.
print (num, end=" ") # This line will print numbers in one line.
# New line after each row to display pattern correctly.
print()
Output :
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Attachments:
Similar questions