0% found this document useful (0 votes)
5 views1 page

xiG nested loops

The document presents various examples of nested loops in programming, demonstrating different output patterns. It includes ten code snippets that illustrate how nested loops function, with varying conditions and print statements. Each example highlights the structure and behavior of loops, such as while loops and for loops, and their impact on output generation.

Uploaded by

ayushloveshaurya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

xiG nested loops

The document presents various examples of nested loops in programming, demonstrating different output patterns. It includes ten code snippets that illustrate how nested loops function, with varying conditions and print statements. Each example highlights the structure and behavior of loops, such as while loops and for loops, and their impact on output generation.

Uploaded by

ayushloveshaurya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Topic: Loops

Sub Topic: nested loops

Find outputs and print loop description table:


1 a=1 6 for a in range(1,5):
while a<5: x=a
b=1 for b in range(1,6):
while b<4: print(x, end=" ")
print(b , end=" ") x=x+1
b+=1 print()
print()
a=a+1

2 x=5 7 x=1
for a in range(1,5): for a in range(1,4):
for b in range(1,6): for b in range(1,6):
print(x, end=" ") if x<10:
print("",x, end=" ")
print() else:
x=x+5 print(x,end=" ")
x=x+2
print()

3 x=65 8 x=122
for a in range(1,5): for a in range(1,5):
for b in range(1,6): for b in range(1,6):
print(chr(x),end=" ") print(chr(x),end=" ")
x=x+1 x=x-1
print() print()

4 x=122 9 for a in range(1,6):


for a in range(1,3): for b in range(1,7):
for b in range(1,14): if a%2==1:
print(chr(x),end=" ") print('@',end=" ")
x=x-1 else:
print() print("#",end=" ")
print()

5 for a in range(1,8): 10 for a in range(1,8):


for b in range(1,11): for b in range(1,11):
print(a*b,end=" ") print(a,' x ' ,b , ' = ', a*b)
print()
print()

You might also like