Write a python program to display the following pattern:
1
1*2
1*2*3
1*2*3*4
1*2*3*4*5
Answers
Answered by
2
Answer:
row = int(input())
for i in range(0, row):
c = 1
print(c, end='')
for j in range(1,i+1):
print('*', end='')
c = c + 1
print(c, end='')
print(' ')
Explanation:
Answered by
3
Solution:
The given code is written in Python.
for i in range(1,6):
print(*range(1,i+1),sep="*")
Logic:
- Run a loop in the range i = (1 to 5).
- Display list of numbers in the range 1 to i with '*' as separator.
See the attachment for output.
Attachments:
Similar questions
Music,
1 month ago
History,
1 month ago
Math,
1 month ago
Social Sciences,
2 months ago
Computer Science,
2 months ago
English,
9 months ago
Math,
9 months ago