#include <stdio.h>
#include <unistd.h>

main(){
int i,j;

j=0;
printf("ready to fork...\n");
i=fork();

if(i==0){
printf("the child excutes this code.\n");
for(i=0;i<5;i++)
j=j+i;
printf("child j=%d\n",j);
}
else
{
j=wait();
printf("the parent excutes this code.\n");
printf("parent j=%d\n",j);
}
}

