Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. factorial n = if n == 0 then 1 else n * factorial (n - 1)
  2.  
  3. main = do putStrLn "What is 5! ?"
  4. x <- readLn
  5. if x == factorial 5
  6. then putStrLn "Yepp!"
  7. else putStrLn "Nope, wrong!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement