code can be re-written as
main {
fork();
fork();
printf("yes");
}
first fork() will going to create a child process,which is going to execute the next instruction i.e 2nd fork() and parent process also going to execute 2nd fork.
so now 2 more process will be created. so in system now there are 4 process and they are going to execute printf statement. so total no, of yes will be 4
++> Total number of times yes will be printed = 4