Answer to Question #222562 in Python for Ravi

Question #222562

Given N and need print the pattern given below


input:

N = 5

output :

2 6 

3 7 10

4 8 11 13

5 9 12 14 15


1
Expert's answer
2021-08-02T07:16:42-0400
N=int(input())
for i in range(N):
    x=i+1
    y=N-1
    for j in range(i+1):
        print(format(x,"<3"),end='')
        x+=y
        y-=1
    print("")

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS