artyom_h31

Haskell Task 1

Oct 11th, 2015
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fact :: Int -> Int
  2. fact x = if x <= 1 then 1 else x * fact (x - 1)
  3.  
  4. factString :: String -> String
  5. factString str = show (fact (read str))
  6.  
  7. main = do
  8.     putStrLn "Put an input number here"
  9.     numString <- getLine
  10.     putStrLn (factString numString)
Advertisement
Add Comment
Please, Sign In to add comment