diff --git a/channels/demo1.go b/channels/demo1.go index d3096e5..3de302c 100644 --- a/channels/demo1.go +++ b/channels/demo1.go @@ -1,10 +1,18 @@ package channels +import ( + "fmt" + "time" +) + func EvenNumber(EvenNumberCn chan int) { total := 0 for i := 0; i <= 10; i+=2 { total = total + i + fmt.Println("Even Number is working") + time.Sleep(1 * time.Second) } + EvenNumberCn <- total } @@ -12,6 +20,8 @@ func OddNumber(OddNumberCn chan int) { total := 0 for i := 1; i <= 10; i+=2 { total = total + 1 + fmt.Println("Odd Number is working") + time.Sleep(1 * time.Second) } OddNumberCn <- total } \ No newline at end of file