Triangle pattern code using python
Print the pattern for given n numbers rows
Pattern
1 2 3 4
1 2 3
1 2
1
CODE
n=int(input())
i=0
while i<=n:
j=1
temp=1
while j <= n - i:
print (temp, end='')
j = j + 1
temp = temp + 1
print()
i = i + 1
Given input :
5
Ouput:
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
Comments
Post a Comment