Write a program to print the following pattern:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Answers
Answered by
5
Answer:
There is a typical structure to print any pattern, i.e., the number of rows and columns. We need to use two loops to print any pattern, i.e., use nested loops. The outer loop tells us the number of rows, and the inner loop tells us the column needed to print the pattern. Accept the number of rows from a user using the input() function to decide the size of a pattern.
Similar questions