Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

37
Task/Nth/Go/nth.go Normal file
View file

@ -0,0 +1,37 @@
package main
import "fmt"
func ord(n int) string {
s := "th"
switch c := n % 10; c {
case 1, 2, 3:
if n%100/10 == 1 {
break
}
switch c {
case 1:
s = "st"
case 2:
s = "nd"
case 3:
s = "rd"
}
}
return fmt.Sprintf("%d%s", n, s)
}
func main() {
for n := 0; n <= 25; n++ {
fmt.Printf("%s ", ord(n))
}
fmt.Println()
for n := 250; n <= 265; n++ {
fmt.Printf("%s ", ord(n))
}
fmt.Println()
for n := 1000; n <= 1025; n++ {
fmt.Printf("%s ", ord(n))
}
fmt.Println()
}