// 1 process
if(fork() && fork()) // creates 2 more // After first fork() only parent one will execute 2nd fork().
{
fork(); // very first parent process will get here and creates one more process.
}
===== here total process = 4. ( 1 is new process created by 1st fork and total 3 by parent process)
if(fork() || fork()) // creates 2 more by each 4 process. Here only new child by first fork() will execute 2nd fork.
{
// 2 process reach here (original plus 1st child that tried 2nd fork above)
fork();
fork();
// here tota = 8 process inside this "if" body.
}
total process here = 4 * ( 1 + 8) = 36.
printf("GATE 2017");
Ans = 36
Refer the following tree diagram =>