sum: range

This commit is contained in:
vinchent 2024-09-10 21:16:01 +02:00
parent 5775ea5e50
commit b427b8fbfb

View File

@ -3,8 +3,8 @@ package sum
func Sum(numbers [5]int) int {
sum := 0
for i := 0; i < 5; i++ {
sum += numbers[i]
for _, number := range numbers {
sum += number
}
return sum
}