time.sleep added to EvenNumber and OddNumber functions
This commit is contained in:
parent
7bf7c19c99
commit
db98168389
1 changed files with 10 additions and 0 deletions
|
@ -1,10 +1,18 @@
|
||||||
package channels
|
package channels
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
func EvenNumber(EvenNumberCn chan int) {
|
func EvenNumber(EvenNumberCn chan int) {
|
||||||
total := 0
|
total := 0
|
||||||
for i := 0; i <= 10; i+=2 {
|
for i := 0; i <= 10; i+=2 {
|
||||||
total = total + i
|
total = total + i
|
||||||
|
fmt.Println("Even Number is working")
|
||||||
|
time.Sleep(1 * time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
EvenNumberCn <- total
|
EvenNumberCn <- total
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +20,8 @@ func OddNumber(OddNumberCn chan int) {
|
||||||
total := 0
|
total := 0
|
||||||
for i := 1; i <= 10; i+=2 {
|
for i := 1; i <= 10; i+=2 {
|
||||||
total = total + 1
|
total = total + 1
|
||||||
|
fmt.Println("Odd Number is working")
|
||||||
|
time.Sleep(1 * time.Second)
|
||||||
}
|
}
|
||||||
OddNumberCn <- total
|
OddNumberCn <- total
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue