Problem Statement
Let's define the evenoddity of an integer x as the sum of its even digits minus the sum of its odd digits. For example, the evenoddity of 239 is (2) - (3 + 9) = -10.
You are given an int X. Return its evenoddity.
Definition
- Class:
- Evenoddity
- Method:
- get
- Parameters:
- int
- Returns:
- int
- Method signature:
- int get(int X)
- (be sure your method is public)
Constraints
- X will be between 1 and 10000, inclusive.
Examples
123
Returns: -2
The evenoddity of 123 is (2) - (1 + 3) = -2.124
Returns: 5
The evenoddity of 124 is (2 + 4) - (1) = 5.1
Returns: -1
8118
Returns: 14
6010
Returns: 5