Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
39
Task/Nth/FreeBASIC/nth.basic
Normal file
39
Task/Nth/FreeBASIC/nth.basic
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
' Apostrophes NOT used as incorrect English
|
||||
|
||||
Function ordinal(n As UInteger) As String
|
||||
Dim ns As String = Str(n)
|
||||
Select Case Right(ns, 1)
|
||||
Case "0", "4" To "9"
|
||||
Return ns + "th"
|
||||
Case "1"
|
||||
If Right(ns, 2) = "11" Then Return ns + "th"
|
||||
Return ns + "st"
|
||||
Case "2"
|
||||
If Right(ns, 2) = "12" Then Return ns + "th"
|
||||
Return ns + "nd"
|
||||
Case "3"
|
||||
If Right(ns, 2) = "13" Then Return ns + "th"
|
||||
Return ns + "rd"
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Dim i As Integer
|
||||
For i = 0 To 25
|
||||
Print ordinal(i); " ";
|
||||
Next
|
||||
Print : Print
|
||||
|
||||
For i = 250 To 265
|
||||
Print ordinal(i); " ";
|
||||
Next
|
||||
Print : Print
|
||||
|
||||
For i = 1000 To 1025
|
||||
Print ordinal(i); " ";
|
||||
Next
|
||||
Print : Print
|
||||
|
||||
Print "Press any key to quit"
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue