mirror of
https://gitlab.com/mfocko/CodeWars.git
synced 2024-11-09 02:59:06 +01:00
6 lines
136 B
Haskell
6 lines
136 B
Haskell
|
module DigitalRoot where
|
||
|
|
||
|
digitalRoot :: Integral a => a -> a
|
||
|
digitalRoot 0 = 0
|
||
|
digitalRoot n = if n `mod` 9 == 0 then 9 else n `mod` 9
|