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
N = int(input())
K = int(input())
for i in range(K):
for j in range(i + 1):
print(N, end=' ')
N += 1
print()
Comments
Leave a comment