1# Program published on https://beginnersbook.com
2
3# Python program to sum all the digits of an input number
4
5num = int(input("Enter a Number: "))
6result = 0
7hold = num
8
9# while loop to iterate through all the digits of input number
10while num > 0:
11 rem = num % 10
12 result = result + rem
13 num = int(num/10)
14
15# displaying output
16print("Sum of all digits of", hold, "is: ", result)