Half Pyramid - 4
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.
N = int(input())
K = int(input())
L = 0
for k in range(1,K+1):
L +=k
maxValue = N + (L-1)
for i in range(K):
if i == 0:
print(maxValue,end=' ')
else:
for j in range(1,i+2):
maxValue -=1
print(maxValue,end=' ')
print('')
Comments
Leave a comment