# Title: Sum of digits
# Heading: Python Program to Find the Sum of Digits of a Number
# Level: beginner
# Tags: sum of digits, digits, while loop, modulo
# About: Adds up the digits of a number, taking the last digit with % 10 and removing it with // 10 until none are left.

def sum_of_digits(number):
    """The sum of the digits of a number that isn't negative."""
    total = 0
    while number > 0:
        total += number % 10  # the last digit
        number //= 10         # remove the last digit
    return total


print("Sum of digits of 4728:", sum_of_digits(4728))
print("Sum of digits of 3050:", sum_of_digits(3050))
