Skip to content

Instantly share code, notes, and snippets.

@MehdiK
Created May 5, 2014 18:38
Show Gist options
  • Save MehdiK/b268d505ff5f81e32698 to your computer and use it in GitHub Desktop.
Save MehdiK/b268d505ff5f81e32698 to your computer and use it in GitHub Desktop.
Factorial
open System
printf "Type in a number: "
let number = int32(Console.ReadLine())
let rec factorial n = if n = 1 then 1 else n * factorial(n-1)
printfn "The factorial of %d is %d" number (factorial number)
Console.ReadLine() |> ignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment