The TransCompilator

Solved LeetCode program · 213 of 1,000

#0258 · Add Digits

Easy Math chunk-05.md

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.

Open in Playground Browse all 1,000 problems

Expected stdout

2