Compute the Checksum Seed
Basic SolvedA simple checksum routine starts by summing the decimal digits of an account number. Build that digit-sum step.
Implement `solve(Integer n)` (non-negative) to return the sum of its decimal digits.
Examples
Input
n = 1234Output
10Input
n = 0Output
0Hints
- Repeatedly take Math.mod(n, 10) and divide n by 10.
Tests
Solved on this device only. Sign in with Google to keep your progress across devices.
Your code runs in a secure sandbox against multiple hidden test cases. The problem is solved only when every test passes. Each run is isolated and any data changes are rolled back automatically. Keyboard users: press Esc then Tab to move focus out of the editor.