In this article we will write a program in Python to find if a given number is Disarium Number.I hope you you have pyhon installed in your machine to write this program. If it’s not installed, then you can follow below link for installation.

https://vidyabhandar.com/how-to-install-python-in-windows/

Before writing the program, we need to know What is a Disarium Number. By seeing/listening the word Disarium you might be thinking what is a Disarium Number. So let’s understand the Disarium Number.

Disarium Number : A number is called Disarium if the sum of its digits powered with their respective positions is equal to the number itself.

Is this definition is not easy to understand? Let’s take a Example so that it will be easy to understand. In range 1 to 200 there are 12 Disarium Number 1, 2, 3, 4, 5, 6, 7, 8, 9, 89, 135, 175. So let’s take example of 89 & 135 as below.

I think you understood the Disarium number . So let’s write the program.

``````#program to find if a given number is Disarium.
number = int(input("Enter a number "))
rem = s = 0;
len = len(str(number))

x = number;

#The sum of digits powered with their respective position
while(number > 0):
rem = number%10;
s += int(rem**len);
number = number//10;
len -= 1;

#to check if the sum is equal to the number
if(s == x):
print("Disarium number");
else:
print("Not a Disarium number");

``````

Output: