I got two questions on a mock-exam. I was given the answers but cannot figure out the rationale behind them.

I will first post the code and then the questions and answers. Maybe somebody would be so kind to explain the answers to me? 

```
package main

import "fmt"

func fact(n int, c chan int, d chan int) {

    k := /* code to compute factorial of n */

    z := <- d

    c <- k + z

    d <- z + 1

}

func main() {

    r := 0

    c := make(chan int)
    d := make(chan int)

    for i = 0 ; i < N ; i++ {
        go fact(i,c,d)
    }

    d <- 0

    for j = 0 ; j < N ; j++ {
        r = r + <-c
    }

    fmt.Printf("result = %d\n",r)

}

```

The first question is: 

How does the program behave if we omit the line "d <- 0" in the main procedure, and why?

The answer from the teacher is: 

The state of all the threads are blocked and also the main thread. 

The second question is: 

How would the efficiency of the whole program be affected if we swapped the first two lines of the fact procedure?

The answer is: 

All threads are going to run sequentially. Each thread would trigger another thread only when it is finished.