1
0
Fork 0
mirror of https://gitlab.com/mfocko/CodeWars.git synced 2024-11-14 05:09:41 +01:00
CodeWars/6kyu/sum_of_digits__digital_root/solution.hs

6 lines
136 B
Haskell
Raw Normal View History

module DigitalRoot where
digitalRoot :: Integral a => a -> a
digitalRoot 0 = 0
digitalRoot n = if n `mod` 9 == 0 then 9 else n `mod` 9