/*    main program illustrating the UNIX fork() system call. 
Compile using cc -o main main.c
*/
#include <stdio.h>
int a;

void count1() {
  a++;
  printf("%d", a);
}

void count2() {
  a += 2;
  printf("%d", a);
}

void count3() {
  a += 3;
  printf("%d", a);
}


int main()
{   
  count1();
  
  int pid = fork();
  
  if (pid > 0) {
    wait(NULL);
    count2();
    count1();
  }
  else if (pid == 0) {
    count1();
    count3();
  }
    //printf("Using fork() system call\n");
    return 0;
}