Help for this page

Select Code to Download


  1. or download this
    fac n = product [1..n]
    
  2. or download this
    fac n = if n<1 then 1 else n * (fac (n-1))
    
  3. or download this
    fac 0 = 1
    fac n = n * fac (n-1)
    
  4. or download this
    fac n | n == 0 = 1
          | otherwise = n * (fac (n-1))
    
  5. or download this
    sub fac 
    {
    ...
            return $n*fac($n-1);
        }
    }