6. Recursive functions Flashcards
1
Q
give a recursive function to calculate the factorial
A
fac :: Int -> Int
fac 0 = 1
fac n = n * fac(n-1)
1. Haskell > 6. Recursive functions > Flashcards
give a recursive function to calculate the factorial
fac :: Int -> Int
fac 0 = 1
fac n = n * fac(n-1)