diff --git a/moduledemo/calc/calcdemo.go b/moduledemo/calc/calcdemo.go new file mode 100644 index 0000000..a20ca39 --- /dev/null +++ b/moduledemo/calc/calcdemo.go @@ -0,0 +1,17 @@ +package calc + +func Add(a, b float64) float64 { + return a + b +} + +func Sub(a, b float64) float64 { + return a - b +} + +func Mult(a, b float64) float64 { + return a * b +} + +func Divi(a, b float64) float64 { + return a / b +} diff --git a/moduledemo/go.mod b/moduledemo/go.mod new file mode 100644 index 0000000..e6b2088 --- /dev/null +++ b/moduledemo/go.mod @@ -0,0 +1,3 @@ +module moduledemo + +go 1.17 diff --git a/moduledemo/main.go b/moduledemo/main.go new file mode 100644 index 0000000..9f37a5b --- /dev/null +++ b/moduledemo/main.go @@ -0,0 +1,15 @@ +package main + +import ( + "fmt" + "moduledemo/calc" +) + +func main() { + var a, b float64 + a, b = 6, 3 + fmt.Println(calc.Add(a, b)) + fmt.Println(calc.Sub(a, b)) + fmt.Println(calc.Mult(a, b)) + fmt.Println(calc.Divi(a, b)) +}