You are given an integer N. Print N rows starting from 1 in the triangle order as shown in the explanation.
Explanation:
Given N=5.
The triangle order for the given N is
1
2 6
3 7 10
4 8 11 13
5 9 12 14 15
1
Expert's answer
2021-09-16T15:36:44-0400
N=int(input())
for i in range(N):
v=i+1
d=N-1
for j in range(i+1):
print(format(v,"<4"),end=" ")
v=v+d
d=d-1
print()
Comments
Leave a comment