Suppose we have a process m. In the first if block, by executing fork() we will have two processes m & c1.
Since pid of c1 is 0, it will not be executed. now parent process will further execute fork which will give m & c2. Since m && c2 = 0 it will fail if condition and we will only left with m which will enter into if block and execute fork(), thus giving m and c3.
Now we have 4 processes namely m, c1, c2, c3. take c1 for example.
In the first fork(), it will split into c1 an c4. since c1 > 0, condition is true and it will enter in if block anf execute fork().
whereas c4 will continue executing conditional statement and call fork(). Now it has c4 and c6. since c6 is 0, if condition fails here and we will only left with c4 which call fork() and give c4 and c7.
In short c1 will give 5 processes. similarly m, c2, c3 will give 5 processes. So in total we will have 20 processes and each will print given statement.
![](https://gateoverflow.in/?qa=blob&qa_blobid=4561600126056421029)