## Python Program to Print Strong Numbers

- Write a Python Program to print Strong numbers from 1 to 10000, or 1 to n, or minimum to maximum with an example.
- First, we used For Loop to iterate a loop between 1 and maximum value. Within the Python for loop,
- We used While Loop to split the given number. So that we can find the factorial of each Digit in a Number.
- Within the While loop, we used the factorial function to find the factorial.
- The if statement checks whether a given number is Strong Number or Not by comparing the original value with the sum of factorials.

### Source Code:

# Python Program to print Strong Numbers from 1 to N

import math

maximum = int(input(" Please Enter the Maximum Value: "))

for Number in range(1, maximum):

Temp = Number

Sum = 0

while(Temp > 0):

Reminder = Temp % 10

Factorial = math.factorial(Reminder)

Sum = Sum + Factorial

Temp = Temp // 10

if (Sum == Number):

print(" %d is a Strong Number" %Number)

import math

maximum = int(input(" Please Enter the Maximum Value: "))

for Number in range(1, maximum):

Temp = Number

Sum = 0

while(Temp > 0):

Reminder = Temp % 10

Factorial = math.factorial(Reminder)

Sum = Sum + Factorial

Temp = Temp // 10

if (Sum == Number):

print(" %d is a Strong Number" %Number)

## Comments

## Post a Comment