Question: Create a function with the name childCode for the child process code. This function doesn t return anything at all ( void ) . This
Create a function with the name childCode for the child process code. This function doesnt return anything at all void This function must use if statements to decide which arithmetic operation it needs to execute and print.
For each child make sure it prints its own process id and the result of the assigned arithmetic operation.
If the user requests less than children, then execute only the operations up to the number of children requested and end the program.
If the user requests more than children, then execute all the operations and for all the additional children print this message: Child with pid#XXXX says: Im a child with no task!cromero@devipc: Lab$ nano nforkmath.c
cromero@devipc: habs$ gcc nforkmath.c o nforkmath
cromero@devipc: ab $nforkmath
How many children do you need?
Enter the first integer number:
Enter the second integer number:
Child with pid# says: Im working on task #
child with pid# says:
Parent says: The child with pid# has finished!
Child with pid# says: Im working on task #
Child with pid# says:
Parent says: The child with pid# has finished!
Child with pid# says: Im working on task #
Child with pid# says:
Parent says: The child with pid# has finished!
Child with pid# says: Im working on task #
Child with pid# says:
Parent says: The child with pid# has finished!
Child with pid# says: Im working on task #
Child with pid# says: Im a child with no task!
Parent says: The child with pid# has finished!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
