Check if a number is strong number Dry Run in PYTHON

Check if a number is strong number is an interactive PYTHON dry run visualizer from the For programs section. Study the source code, then use the execution controls to follow each step, variable update, highlighted line, and console output.

This page provides a browser-based dry run with source-code highlighting, auto-scroll, voice narration controls, and execution output for learning the program step by step.

Check if a number is strong number Program Code

# Strong number: sum of factorial of digits = number itself
# Example: 145 = 1! + 4! + 5! = 1 + 24 + 120 = 145

num = int(input("Enter a number: "))
original = num
sum_fact = 0

for digit_char in str(num):
    digit = int(digit_char)
    fact = 1
    for i in range(1, digit + 1):
        fact *= i
    sum_fact += fact

if sum_fact == original:
    print(f"{original} is a strong number")
else:
    print(f"{original} is NOT a strong number")

View the complete For programs page.

Program Console Check if a number is strong number Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.