Write a program to display the pattern given below.
Sample Input:
5
Sample Output:
ABCDE
1 2 34
ABC
12
A
Answers
Answered by
0
Answer:
Explanation:
Assuming if it's python
import string
letters = string.ascii_uppercase
digits = string.digits[1:]
def print_pattern(num):
for slice in list(range(num))[::-1]:
if (slice+1) % 2 == 0:
continue
print(letters[:slice+1])
print(digits[:slice])
print_pattern(5)
this will print the following output:
ABCDE
1234
ABC
12
A
Similar questions