Challenge 6 - Digit Sums

Finding the digit sum of a number means adding the values of all of its digits. For example, the digit sum of 123 is 1 + 2 + 3 = 6.

A mathematical algorithm for calculating a digit sum is:

  1. Add the last digit of the number to the sum.
  2. Remove the last digit of the number.
  3. Repeat the previous two steps while the number is greater than zero.
  4. Print the sum.

Drag blocks from the left to perform the algorithm, then click the "Run Code" button to see the output.

OutputPython Code
Home