push all exercices

This commit is contained in:
lbenedar
2026-02-21 14:09:13 +03:00
commit a94d994b8c
72 changed files with 787 additions and 0 deletions

26
ch4/2/ch4_2.go Normal file
View File

@@ -0,0 +1,26 @@
package main
import (
"fmt"
"math/rand"
)
func main() {
const numElems = 10
randSlice := make([]int64, numElems)
for i := 0; i < numElems; i++ {
randSlice[i] = rand.Int63n(100)
}
for _, v := range randSlice {
if v%6 == 0 {
fmt.Println("Six!")
} else if v%2 == 0 {
fmt.Println("Two!")
} else if v%3 == 0 {
fmt.Println("Three!")
} else {
fmt.Println("Never mind")
}
}
fmt.Println(randSlice)
}