Write a python program to find if a number is distinct number or not.
example: distinct number = 135,89 etc because, 135= 1^1 +3^2 + 5^3 = 135
Answers
Answered by
1
number = str(int(input("Enter your number: "))).replace("", " ").split() # splitting the digits
sum_ = 0
counter = 0
for i in number:
counter += 1
sum_ += int(i) * * counter
number = int("".join(number))
if sum_ == number:
print(f"{number} is distinct number. ")
else:
print(f"{number} is not distinct number. ")
Similar questions