Solved LeetCode program · 213 of 1,000
#0258 · Add Digits
Original English source
Keep a shared result of 0.
To gather from value (a whole number) with total (a whole number). If value is 0, set result to total, return. Gather from value divided by 10 with total plus value modulo 10.
The number is 38. The value is number.
Repeat while value is at least 10.
Gather from value with 0. Set value to result.
Show value.
Expected stdout
2