#include #include #include #include #include void Count(int start, char ch); int main(int argc, char *arg[]) { int pid; int start = 0; pid=fork(); if (pid > 0) { // parent continues here Count(start, 'P'); wait(NULL); // To get printing done before shell prompt shows } else if (pid == 0) // child got here! Count(start, 'C'); else // only if there was a problem with fork exit(-1); } void Count(int start, char ch) { int i, j; for (i = start; i < 100; i++) { for (j = 0; j < 1000000; j++) ; printf("\n%c : %d",ch,i); } }