Header Ads

Responsive Ads Here

Disarium numbers

Disarium numbers


num = int(input("Enter the number: "))
dig_num = len(str(num))

count = 0
sum = 0
for i in str(num):
    count += 1
    for j in range(count, dig_num + 1):
        sum += int(i)**j
        break

if num == sum:
    print("The number is a disarium number!!")
else:
    print("The number is not a disarium number!!")

Answer


Enter the number: 5 The number is a disarium number!!



YouTube Link:

Powered by Blogger.