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

BIN
ch5/1/ch5_1.exe Normal file

Binary file not shown.

20
ch5/1/ch5_1.go Normal file
View File

@@ -0,0 +1,20 @@
package main
import (
"errors"
"fmt"
)
func simpleCalculator(dividend, divisor int) (int, error) {
if divisor == 0 {
err := errors.New("division by zero")
return 0, err
}
return dividend / divisor, nil
}
func main() {
fmt.Println(simpleCalculator(5, 2))
fmt.Println(simpleCalculator(5, 0))
fmt.Println(simpleCalculator(17, 6))
}

3
ch5/1/go.mod Normal file
View File

@@ -0,0 +1,3 @@
module ch5_1
go 1.25.0