I have a number like this:
n = 548915381
The output should be the sum of every second digit of that number. In this case 26:
4+9+5+8 = 26
Rules:
- This is a code-golf, so the shortest code in bytes wins.
- The input consists only of numbers bigger than 10 (at least 2 digits) but smaller than a 32-bit integer.
- The input will be a number, not a string
Test cases:
Input | Output |
---|---|
10 | 0 |
101011 | 1 |
548915381 | 26 |
999999 | 27 |
2147483647 | 29 |
999999999 | 36 |