sum of digits fomula code example
Example: sum of digits
num = [int(d) for d in input("Enter the Number:")]
sum = 0
for i in range(0, len(num)):
sum = sum + num[i]
print("Sum of Digits of a Number: {}".format(sum))
# This code is contributed by Shubhanshu Arya (Prepinsta Placement Cell Student)