mirror of
https://gitlab.com/mfocko/CodeWars.git
synced 2024-11-08 18:49:07 +01:00
5 lines
136 B
Haskell
5 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
|