Advertisement
vencinachev

E1

Nov 12th, 2021
1,533
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. main :: IO()
  2. main = do
  3.    putStr "Enter FB: "
  4.    line1 <- getLine
  5.    putStr "Enter FC: "
  6.    line2 <- getLine
  7.    let fb = read line1 :: Integer
  8.    let fc = read line2 :: Integer
  9.    print ((max (fibonacci fb) (factorial fc)))
  10.  
  11. factorial :: Integer -> Integer
  12. factorial n
  13.    | n == 0     = 0
  14.    | n == 1     = 1
  15.    | otherwise  = n * factorial (n-1)
  16.  
  17. fibonacci :: Integer -> Integer
  18. fibonacci n
  19.    | n == 0 || n == 1 = 1
  20.    | otherwise        =  fibonacci (n-2) + fibonacci (n-1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement