Program Console Vignaankosh.com
Execution Panel
Console is empty.
Sum of digits of a number is an interactive PYTHON dry run visualizer from the While 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.
# Sum of digits in a number
num = int(input("Enter a number: "))
original = num
sum_digits = 0
num = abs(num) # Handle negative numbers
while num > 0:
digit = num % 10
sum_digits += digit
num //= 10
print(f"Sum of digits of {original} = {sum_digits}")