Question: Exercise 5 - Programming with fork Write a C program called sumfact.c that does the following: Takes an integer argument ( say , N 1

Exercise 5- Programming with fork
Write a C program called sumfact.c that does the following:
Takes an integer argument (say, N1) from the command line.
Forks two children processes
a. First child computes 1+2+dots+N(sum of positive integers up to N ) and prints out the result
and its own identifier.
b. Second child computes 1*2*dots*N(the factorial of N ) and prints out the result and its own
identifier.
Parent waits until both children are finished, then prints out the message "Done" and its own
identifier.
Sample execution (assuming the executable is called sumfact):
bash$./sumfact 5
[ID =101] Sum of positive integers up to 5 is 15
[ID =102 Factorial of 5 is 120
ID=100 Done
Help me about it please
 Exercise 5- Programming with fork Write a C program called sumfact.c

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!