Challenge I create the base case for fibonnaci 0 and fibonnaci 1, and recurse for higher inputs. module Main where fibonacci 0 = 0 fibonacci 1 = 1 fibonacci n = fibonacci (n - 1) + fibonacci (n - 2) -- This part is related to the Input/Output and can be used as it is -- Do not modify it main = do input <- getLine print . fibonacci . (read :: String -> Int) $ input
Hackerrank Fibonnaci (Haskell)
Hackerrank Fibonnaci (Haskell)
Hackerrank Fibonnaci (Haskell)
Challenge I create the base case for fibonnaci 0 and fibonnaci 1, and recurse for higher inputs. module Main where fibonacci 0 = 0 fibonacci 1 = 1 fibonacci n = fibonacci (n - 1) + fibonacci (n - 2) -- This part is related to the Input/Output and can be used as it is -- Do not modify it main = do input <- getLine print . fibonacci . (read :: String -> Int) $ input