10.Multiply Evens by Odds - Java
Java
Добър ден,
имам проблем със задача 10. Multiply Evens by Odds от лекцията Methods.
Задачата върви добре само когато зададеното от конзолата число е положително. Опитах да поправя кода, за да върви и при отрицателнир но ми дава грешка.
Това е задачата:
Create a program that reads an integer number and multiplies the sum of all its even digits by the sum of all its odd digits:
Examples
| Input | Output | Comments | 
| 12345 | 54 | 12345 has 2 even digits - 2 and 4. Even digits have sum of 6. Also it has 3 odd digits - 1, 3 and 5. Odd digits have sum of 9. Multiply 6 by 9 and you get 54. | 
| -12345 | 54 | 
 | 
А това кода ми:
https://pastebin.com/RDNNwXxJ
Благодаря предварително!