Nested Loop: If one loop contains another loop and so on is called nested loops.
Program:
for i in range(1,5):
for
j in range(1,i+1):
print(i,j)
Output:
1
1
2
1
2
2
3
1
3
2
3
3
4
1
4
2
4
3
4
4
Nested Loop: If one loop contains another loop and so on is called nested loops.
Program:
for i in range(1,5):
for
j in range(1,i+1):
print(i,j)
Output:
1
1
2
1
2
2
3
1
3
2
3
3
4
1
4
2
4
3
4
4
Comments
Post a Comment