package main import "fmt" func main() { slice := []int{1, 2, 7, 6, 7, 9, 10, 11, 5, 3} for i := 0; i < len(slice) - 1; i++ { for j := 0; j < len(slice) - 1; j++ { if slice[j] < slice[j+1] { slice[j], slice[j + 1] = slice[j + 1], slice[j] } } } fmt.Println(slice) }
好快乐好简洁