[]int{1, 3, 5, 9} par := []int{2, 4, 6, 8} go soma(impar) go soma(par) } func soma(a []int) int { soma := 0 for _, v := range a { soma += v } return soma }
[]int{1, 3, 5, 9} par := []int{2, 4, 6, 8} go soma(impar) go soma(par) } func soma(a []int) int { soma := 0 for _, v := range a { soma += v } return soma }
[]int{1, 3, 5, 9} par := []int{2, 4, 6, 8} c := make(chan int) go soma(impar) go soma(par) } func soma(a []int) int { soma := 0 for _, v := range a { soma += v } return soma }
[]int{1, 3, 5, 9} par := []int{2, 4, 6, 8} c := make(chan int) go soma(impar) go soma(par) } func soma(a []int) int { soma := 0 for _, v := range a { soma += v } return soma }
[]int{1, 3, 5, 9} par := []int{2, 4, 6, 8} c := make(chan int) go soma(impar, c) go soma(par, c) } func soma(a []int) int { soma := 0 for _, v := range a { soma += v } return soma }
[]int{1, 3, 5, 9} par := []int{2, 4, 6, 8} c := make(chan int) go soma(impar, c) go soma(par, c) } func soma(a []int, c chan int) int { soma := 0 for _, v := range a { soma += v } return soma }
[]int{1, 3, 5, 9} par := []int{2, 4, 6, 8} c := make(chan int) go soma(impar, c) go soma(par, c) } func soma(a []int, c chan int) int { soma := 0 for _, v := range a { soma += v } return soma }
[]int{1, 3, 5, 9} par := []int{2, 4, 6, 8} c := make(chan int) go soma(impar, c) go soma(par, c) } func soma(a []int, c chan int) { soma := 0 for _, v := range a { soma += v } c <- soma }
[]int{1, 3, 5, 9} par := []int{2, 4, 6, 8} c := make(chan int) go soma(impar, c) go soma(par, c) x, y := <-c, <-c fmt.Println(“Primeira soma: ”, x) fmt.Println(“Segunda soma: ”, y) } func soma(a []int, c chan int) { soma := 0 for _, v := range a { soma += v } c <- soma }