Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Nth/F-Sharp/nth.fs
Normal file
15
Task/Nth/F-Sharp/nth.fs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
open System
|
||||
|
||||
let ordinalsuffix n =
|
||||
let suffixstrings = [|"th"; "st"; "nd"; "rd"|]
|
||||
let (d, r) = Math.DivRem(n, 10)
|
||||
n.ToString() + suffixstrings.[ if r < 4 && (d &&& 1) = 0 then r else 0 ]
|
||||
|
||||
|
||||
[<EntryPoint>]
|
||||
let main argv =
|
||||
let show = (Seq.iter (ordinalsuffix >> (printf " %s"))) >> (Console.WriteLine)
|
||||
[0..25] |> show
|
||||
[250..265] |> show
|
||||
[1000..1025] |> show
|
||||
0
|
||||
Loading…
Add table
Add a link
Reference in a new issue