dropOdds :: Int -> Int
dropOdds x
| x > 10 = 10 * dropOdds restDigits + dropOdds firstDigit
| otherwise = dropOddsOneDigit x
where
firstDigit = x mod 10
restDigits = x div 10
dropOddsOneDigit x
| x mod 2 == 0 = x
| otherwise = 0
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
dropOdds :: Int -> Int
dropOdds x
| x > 10 = 10 * dropOdds restDigits + dropOdds firstDigit
| otherwise = dropOddsOneDigit x
where
firstDigit = x
mod
10restDigits = x
div
10dropOddsOneDigit x
| x
mod
2 == 0 = x| otherwise = 0