Skip to content

Instantly share code, notes, and snippets.

@MehdiK
MehdiK / gist:dc6354e3a06e17b59dff
Created May 5, 2014 18:31
a program which accepts numbers as arguments and which determines the lowest and highest number
open System
[<EntryPoint>]
let main(args) =
let numArgs = Array.map (fun arg -> int32(arg)) args
printfn "Read %d numbers" args.Length
printfn "Min value %d" (Array.min numArgs)
printfn "Max value %d" (Array.max numArgs)
Console.ReadLine() |> ignore
0
open System
let rec PrintReverse () =
let input = Console.ReadLine()
if input <> "END" then
PrintReverse() |> ignore
printfn "-> %s" input
PrintReverse()
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