Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

EXP :

DATE :

AIM

ALGORITHM
OUTPUT
PROGRAM
low = int(input("enter the lower bound :"))
high = int(input("enter the higher bound :"))
for n in range(low, high + 1):

# order of number
order = len(str(n))

# initialize sum
sum = 0

temp = n
while temp > 0:
digit = temp % 10
sum += digit ** order
temp //= 10
if n == sum:
print(n, end=" ")

RESULT

You might also like