## Python program to print all disarium numbers between 1 and 100

In this program, we need to print all disarium numbers between 1 and 100 by following the algorithm as given below:

### ALGORITHM:

• STEP 1: CalculateLength() counts the digits present in a number.
1. Use a while loop to check whether the number is equal to 0 or not.
2. Divide the number by 10 and increment the variable length by 1.
3. Return length.
• STEP 2: sumOfDigits() calculates the sum of digits raised to their respective positions.
1. Make a call to calculateLength() to get the number of digits present in a given number and store the value in variable len.
2. Using while loop calculates remainder rem repeatedly by dividing num with 10.
3. Calculate the value of rem raised to power its position, i.e., remlen and store the computed value in a variable sum.
• STEP 3: To display all Disarium numbers between 1 and 100,
1. Start a loop from 1 to 100, then make a call to sumOfDigits() method for each value from 1 to 100 and store the return value into a variable result.
2. If the value of the result is equal to the number, it implies that the given number is Disarium number. Hence, display it.

### PROGRAM:

Output:

```Disarium numbers between 1 and 100 are
1  2  3  4  5  6  7  8  9  89
```
Next TopicPython Programs

### Feedback   