num = int(input("Enter the number: ")) sum_of_digits = 0 while num > 0: digit = num % 10 num //= 10 sum_of_digits += digit print("The sum of digits is", sum_of_digits)