RosettaCodeData/Task/Nth/Microsoft-Small-Basic/nth.basic

33 lines
561 B
Plaintext

loLim = 0
hiLim = 25
PrintImages()
loLim = 250
hiLim = 265
PrintImages()
loLim = 1000
hiLim = 1025
PrintImages()
Sub PrintImages
For i = loLim To hiLim
nr = i
GetSuffix()
TextWindow.Write(i + suffix + " ")
EndFor
TextWindow.WriteLine("")
EndSub
Sub GetSuffix
rem10 = Math.Remainder(nr, 10)
rem100 = Math.Remainder(nr, 100)
If rem10 = 1 And rem100 <> 11 Then
suffix = "st"
ElseIf rem10 = 2 And rem100 <> 12 Then
suffix = "nd"
ElseIf rem10 = 3 And rem100 <> 13 Then
suffix = "rd"
Else
suffix = "th"
EndIf
EndSub