Answer to Question #226144 in Python for GANESH

Question #226144

Given an integer N as a starting number and K as input, write a program to print a number pyramid of K rows as shown below


input1 : 10

5

10

11 12

13 14 15

16 17 18 19

20 21 22 23 24


input2: 1

3

1

2 3

4 5 6





1
Expert's answer
2021-08-15T01:16:08-0400
N = int(input())
K = int(input())
for i in range(K):
    for j in range(i + 1):
        print(N, end=' ')
        N += 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