Question: develop c programing language and here I attached program and you can add left c program Develop a program that accepts integers from command line

develop c programing language and here I attached program and you can add left c program

  1. Develop a program that accepts integers from command line and uses fork() to have 4 child processes that will do sorting the integers into ascending order, computing the sum of the integers, and counting the number of even numbers and the number of odd numbers respectively.

/*Template for program */

/*After conversion of string integers to real integers, do the follows so that there are 4 child processes. */ #include #include #include int main(int argc, char * argv[]) { int i=0, data[argc-1], Sum=0, EvenCount=0, OddCount=0; for (i=1; i

switch(fork()) { case -1: break; case 0: /*1st child process*/

/*here for sorting*/

exit(1); default: switch(fork()) { case -1: break; case 0: /*2nd child process*/

/*here for summing*/

exit(2); default: switch(fork()) { case -1: break; case 0: /*3rd child process*/

/*here for counting even*/

exit(3); default: switch(fork()) { case -1: break; case 0: /*4th child process*/

/*here for counting odd*/

exit(4); default: break: } } } } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!