Add package arrays

This commit is contained in:
2022-01-03 17:17:14 +01:00
parent cb26678c66
commit 3569bcd485
2 changed files with 38 additions and 0 deletions

9
arrays/sum.go Normal file
View File

@@ -0,0 +1,9 @@
package main
func Sum(numbers []int) int {
sum := 0
for _, n := range numbers {
sum += n
}
return sum
}