update README.md, new file go/l8.go and binary go/output/l(7/8), l8.go for bubble sort numbers

This commit is contained in:
hhu67 2026-06-03 17:37:33 +03:00
parent 75d556efbe
commit 7a82960a38
4 changed files with 31 additions and 1 deletions

View file

@ -13,3 +13,4 @@ strings:
element := x[index] - для доступа к конкретному элементу, index начинается с 0
x[index] = element - для изменения элемента среза
x = append(x[:index], x[index2]...) - для удаления элемента среза
lenx = len(x) = для подсчета позиций в срезе

29
go/l8.go Normal file
View file

@ -0,0 +1,29 @@
package main
import (
"fmt"
)
func polz() []int {
slice := []int{}
for i := 0; i < 10; i++ {
fmt.Println("Введите числа")
var pol int
fmt.Scan(&pol)
slice = append(slice, pol)
}
return slice
}
func main() {
packages := polz()
lenp := len(packages) -1
for i := 0; i < lenp; i++ {
for j := 1; j <= lenp - i; j++ {
if packages[j-1] > packages[j] {
packages[j-1], packages[j] = packages[j], packages[j-1]
}
}
}
fmt.Println(packages)
}

BIN
go/output/l7 Executable file

Binary file not shown.

BIN
go/output/l8 Executable file

Binary file not shown.