Combined right angle triangle:
Sample input: 4
1st half:
1 2 3 4
5 6 7
8 9
10
2nd half:
17 18 19 20
14 15 16
12 13
11
Output should be combined pattern:
Combined pattern:
1 2 3 4 17 18 19 20
5 6 7 14 15 16
8 9 12 13
10 11
rows = int(input())
print("right angled triangle pattern")
k = 1
for i in range(1, rows + 1):
for j in range(1, i + 1):
print(k, end = ' ')
k += 1
print()
Comments
Leave a comment