Given an integer N as a starting number and K as input, write a python program to print a number pyramid of K rows as shown
In the example, the given starting number is
10, and the number of rows in the pyramid is 5.So, the output should be
10
11 12
13 14 15
16 17 18 19
20 21 22 23 24
N=int(input("Enter starting number: "))
K=int(input("Enter number of rows: "))
for i in range(K):
for j in range(i+1):
print(N,end=" ")
N=N+1
print()
Comments
Leave a comment