Skip to main content

Coding Problem: Oddly Even

Find the difference between the sum of odd and even position digits

Example:

Input 1234

Output 2

Explanation:

sum of values at odd position: 1+3=4

sum of values at even position: 2+4=6

         6-4=2

Code: