// test project main.go
package main
import (
"fmt"
)
func main() {
var a = [10]int{1, 2, 99, 4, 86, 7, 8, 0, 9, 6}
var lens int = len(a)
for i := 0; i < lens; i++ {
for z := i + 1; z < lens; z++ {
if a[i] > a[z] {
temp := a[i]
a[i] = a[z]
a[z] = temp
}
}
}
fmt.Println(a)
}
有疑问加站长微信联系(非本文作者)