NUMBERED TRIANGLE
you are given an integer N. print N rows starting from 1 in the triangle order as shown in the explanation.
INPUT
the input contains an integer N .
OUTPUT
the output shoudl have N lines .
Each of the N lines should have space -seperated integers as per the traingle order.
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-08-10T05:59:46-0400
n = int(input())
for i in range(n):
print(*[i + 1 + int((n - (j + 1) / 2) * j) for j in range(i + 1)])
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment