package main
import "fmt"
func main(){
numArr := [...]int{4,2,9,45,8,36,5,1,82}
numCount := len(numArr)
for i:=0;i<numCount;i++{
for j:=numCount-1;j>0;j--{
if numArr[j] < numArr[j-1] {
numArr[j],numArr[j-1] = numArr[j-1],numArr[j]
}
}
}
fmt.Println(numArr)
}
有疑问加站长微信联系(非本文作者)