Skip to content

Commit e8b785f

Browse files
Create 1_1_1n.py
1 parent 57aa891 commit e8b785f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

pattern/1_1_1n.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
n=int(input("enter a number: "))
2+
i=1
3+
while i<=n:
4+
j=i
5+
c=0
6+
k=j
7+
while j>0:
8+
print(k," ",sep='',end="")
9+
k=k+n-1-c
10+
j-=1
11+
c+=1
12+
i+=1
13+
print()
14+
'''
15+
output:
16+
enter a number: 9
17+
1
18+
2 10
19+
3 11 18
20+
4 12 19 25
21+
5 13 20 26 31
22+
6 14 21 27 32 36
23+
7 15 22 28 33 37 40
24+
8 16 23 29 34 38 41 43
25+
9 17 24 30 35 39 42 44 45
26+
'''

0 commit comments

Comments
 (0)