Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fact :: Int -> Int
- fact x = if x <= 1 then 1 else x * fact (x - 1)
- factString :: String -> String
- factString str = show (fact (read str))
- main = do
- putStrLn "Put an input number here"
- numString <- getLine
- putStrLn (factString numString)
Advertisement
Add Comment
Please, Sign In to add comment