/* include header files */

#include <stdio.h>       // printf
#include <stdlib.h>      // exit
#include <unistd.h>      // sleep, fork
#include <sys/types.h>   // fork, wait
#include <sys/wait.h>    // wait

/* main function */

int main(){         
  
  if ( fork() == 0) { 
    
    /* child section */
    
    printf("Child: sleeping 10 seconds\n");
    sleep(10);
    printf("Child: completed\n");

    exit(7);
  }

  /* parent section */
  
  printf("Parent: waiting until the Child process exits\n");

  wait(NULL);

  printf("Parent: the Child has completed\n");
  
  return 0;
}

