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 4 children, then execute only the operations up to the number of children requested and end the program.
If the user requests more than 4 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: /Lab6$ nano nfork_math.c
cromero@devipc: /habs$ gcc nfork_math.c -o nfork_math
cromero@devipc: //ab $./nfork_math
How many children do you need? 5
Enter the first integer number: 10
Enter the second integer number: 5
Child with pid#34263 says: I'm working on task #1
child with pid#34263 says: 10+5=15
Parent says: The child with pid#34263 has finished!
Child with pid#34264 says: I'm working on task #2
Child with pid#34264 says: 10-5=5
Parent says: The child with pid#34264 has finished!
Child with pid#34265 says: I'm working on task #3
Child with pid#34265 says: 10**5=50
Parent says: The child with pid#34265 has finished!
Child with pid#34266 says: I'm working on task #4
Child with pid#34266 says: 105=2
Parent says: The child with pid#34266 has finished!
Child with pid#34267 says: I'm working on task #5
Child with pid#34267 says: I'm a child with no task!
Parent says: The child with pid#34267 has finished!
 Create a function with the name childCode for the child process

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!