40.WAP to display following pattern
A
B C
D E F
G H I J
K L M N O
P Q R S T U
CODE:
x="A"
y=0
n=int(input("How many rows\n"))
for i in range(0,n+1):
for j in range(0,i+1):
print(chr(ord(x)+y),end=" ")
y=y+1
print()
OUTPUT:
How many rows
5
A
B C
D E F
G H I J
K L M N O
Comments
Post a Comment