From f140ccceba3d3c2d91b7f27f635a5915927956fb Mon Sep 17 00:00:00 2001 From: raul Date: Sun, 25 Feb 2024 07:34:27 +0100 Subject: [PATCH] Added matrix exercise --- matrix/go.mod | 3 +++ matrix/main.go | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 matrix/go.mod create mode 100644 matrix/main.go diff --git a/matrix/go.mod b/matrix/go.mod new file mode 100644 index 0000000..a8a5e9e --- /dev/null +++ b/matrix/go.mod @@ -0,0 +1,3 @@ +module matrix + +go 1.22.0 diff --git a/matrix/main.go b/matrix/main.go new file mode 100644 index 0000000..b008b98 --- /dev/null +++ b/matrix/main.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" +) + +func main() { + a := [][]int{ + {0, 1, 2}, + {3, 4, 5}, + {6, 7, 8}, + } + + for i := 0; i < len(a); i++ { + for _, v := range a[i] { + fmt.Printf("%v", v) + } + fmt.Println() + } +}