package main
import "fmt"
func generate(ch chan int) {
// channel Init.
i := 0
// Channel begin. Eternally Loop.
for {
// To 1000 EndFlag into channel
if i > 1000 {
ch <- -1
}else{
// mod 10 , Zero Count(1) into channel
for j := i;j > 9;j /= 10{
if j % 10 == 0 {
ch <- 1
}
}
}
// Count up
i ++
}
}
func main() {
// allocate channel
ch := make(chan int)
// Count up for first Zero.
myCnt := 1
go generate(ch)
for {
// Recieve Channel
i := <-ch
// EndFlag Cond.
if i < 0 {
break
}
// Countup
myCnt += i
}
fmt.Printf("The amount of Zero is %d ",myCnt)
}