General formula for this fork() related problem is :
Total number of process created = { (2n) -1)+1 }
where (2n) -1 = number of Child Process and 1 is for Parent Process.
and n = number of time fork() is called.
here n = 2
so number of child process is = (2n) -1 = 4 - 1 = 3 and parent process is 1
so output is 3+1 = 4 [ (2n) -1)+1 = 4]
4 times hello would be printed.
hello
hello
hello
hello
here 4 is number of process created among which 3 are child process and 1 is parent process.