14 - Write a program in Python to generate the following pattern using nested loops:
A
AB
ABC
ABCD
ABCDE
for i in range(1,6):
for j in range(1,i+1):
print(chr(j+64),end='')
print()
Output:
A
AB
ABC
ABCD
ABCDE
A
AB
ABC
ABCD
ABCDE
for i in range(1,6):
for j in range(1,i+1):
print(chr(j+64),end='')
print()
Output:
A
AB
ABC
ABCD
ABCDE
5
54
543
5432
54321
for i in range(5,0,-1):
for j in range(5,i-1,-1):
print(j,end='')
print()
Output:
5
54
543
5432
54321
54321
5432
543
54
5
for i in range(1,6):
for j in range(5,i-1,-1):
print(j,end='')
print()
Output:
54321
5432
543
54
5
55555
4444
333
22
1
for i in range(5,0,-1):
for j in range(1,i+1):
print(i,end='')
print()
Output:
55555
4444
333
22
1
12345
1234
123
12
1
for i in range(5,0,-1):
for j in range(1,i+1):
print(j,end='')
print()
Output:
12345
1234
123
12
1
1
22
333
4444
55555
for i in range(1,6):
for j in range(1,i+1):
print(i,end='')
print()
Output:
1
22
333
4444
55555
1
12
123
1234
12345
for i in range(1,6):
for j in range(1,i+1):
print(j,end='')
print()
Output:
1
12
123
1234
12345
11111
22222
33333
44444
55555
for i in range(1,6):
for j in range(1,6):
print(i,end='')
print()
Output:
11111
22222
33333
44444
55555
12345
12345
12345
12345
12345
for i in range(1,6):
for j in range(1,6):
print(j,end='')
print()
Output:
12345
12345
12345
12345
12345
a=int(input("Enter First Number: "))
b=int(input("Enter Second Number: "))
c=int(input("Enter Third Number: "))
if a<=b and a<=c:
print(a," is smallest number")
elif b<=a and b<=c:
print(b," is smallest number")
else:
print(c," is smallest number")
Output:
Enter First Number: 8
Enter Second Number: 5
Enter Third Number: 6
5 is smallest number
Enter First Number: 7
Enter Second Number: 9
Enter Third Number: 2
2 is smallest number
Enter First Number: 4
Enter Second Number: 6
Enter Third Number: 9
4 is smallest number