In C program language 1. Triplet Prodigies: Write a C program called lastname Triplets that accepts any
Fantastic news! We've Found the answer you've been seeking!
Question:
In C program language
Transcribed Image Text:
1. Triplet Prodigies: Write a C program called lastname Triplets that accepts any number of integers. The program (parent process =P) should create 3 children, C1, C2, and C3, sequentially. C1 prints its PID, then computes the sum of the user input. • C2 prints its PID, then computes the product of the user input. C3 prints its PID, then computes the sum of the squares of the user input. The parent should wait for all three children to complete their calculations before printing its own PID and exiting. BE CAREFUL! Only the parent process should create children. The figure below has examples of running the Triplets program. Lab 07 Note: All labs are due before next week's lab starts CIS 370 PetraAW:Lab_07$ ./P1 1 2 4 Child 1 (pid:108) Result: 7 Child 2 (pid:109) Result: 8 Child 3 (pid:110) Result: 21 All children are done PetraAW:Lab_07$ ./P1 1 2 3 4 5 6 7 8 9 10 Child 1 (pid:112) Result: 55 Child 2 (pid:113) Result: 3628800 Child 3 (pid:114) Result: 385 All children are done PetraAW:Lab_07$ The order of events in your program should look as follows: 1. Parent process P creates child process C1 and waits. 2. C1 computes sum, prints result and exits. 3. P creates child C2 and waits. 4. C2 computes product, prints result and exits. 5. P creates child C3 and waits. 6. C3 computes sum of squares, prints result and exits. 7. P prints its message and exits. Due: Week of 10/28/2019 1. Triplet Prodigies: Write a C program called lastname Triplets that accepts any number of integers. The program (parent process =P) should create 3 children, C1, C2, and C3, sequentially. C1 prints its PID, then computes the sum of the user input. • C2 prints its PID, then computes the product of the user input. C3 prints its PID, then computes the sum of the squares of the user input. The parent should wait for all three children to complete their calculations before printing its own PID and exiting. BE CAREFUL! Only the parent process should create children. The figure below has examples of running the Triplets program. Lab 07 Note: All labs are due before next week's lab starts CIS 370 PetraAW:Lab_07$ ./P1 1 2 4 Child 1 (pid:108) Result: 7 Child 2 (pid:109) Result: 8 Child 3 (pid:110) Result: 21 All children are done PetraAW:Lab_07$ ./P1 1 2 3 4 5 6 7 8 9 10 Child 1 (pid:112) Result: 55 Child 2 (pid:113) Result: 3628800 Child 3 (pid:114) Result: 385 All children are done PetraAW:Lab_07$ The order of events in your program should look as follows: 1. Parent process P creates child process C1 and waits. 2. C1 computes sum, prints result and exits. 3. P creates child C2 and waits. 4. C2 computes product, prints result and exits. 5. P creates child C3 and waits. 6. C3 computes sum of squares, prints result and exits. 7. P prints its message and exits. Due: Week of 10/28/2019
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Use in C program language Literally Sorting Given an array of N integers A 1 , A 2 , ..., A N . Sort the integers in ascending order. Input Format The first line contains an integer T, the number of...
-
8) Write a program in C language Write a program to sort data in link list. 9) Write a program in C language Write a program to swap two nodes in double link list. 10) Write a program in C language...
-
Convert the following C program into MIPS assembly language int fact (int n) { if (n < 1) return 1; else return (n * fact (n 1)); }
-
Shown below is information from the financial reports of Knauss Supermarkets for the past few years. Instructions a. Calculate the following statistics for Knauss Supermarkets (round your answers to...
-
What are the symbols used on a structure chart?
-
If the demand for reserves did not fluctuate, the Bank of Canada could pursue both a reserves target and an interest-rate target at the same time. Is this statement true, false, or uncertain? Explain.
-
The comparative financial statements of Perfection Taco Restaurants for 2010, 2009, and 2008 include the following selected data: 2010 (In Thousands) 2009 2008 Balance Sheet Current Assets: Cash...
-
Consider the hypothetical population below, with population values: a. Find the values of the population quantities tx, ty, Sx, Sy, R, and B. b. Construct a table like that in Table 4.2, giving the...
-
Jack is considering purchasing a share of company XYZ. The company has announced that it will pay a dividend of $2 next year. The dividends are expected to grow at the rate of 4%. Jack wants to earn...
-
Dollar Dime Store is a local discount store with the following information: October sales are projected to be $350,000. Sales are projected to increase by 15% in November and another 20% in...
-
The Country Crock Restaurant is considering opening a new restaurant location.You have gathered the following information about this opportunity. The organization owns some land that is suitable for...
-
Cabin financial services group recommends that a client purchase 10,000 a corporate bond that ears 6 percent interest how much additional money must be placed in an investment that earns a simple...
-
4. A projectile is fired at an angle from the top of a cliff as shown in the diagram below. A graph is created of the projectile's vertical motion while it is in the air and is shown here. a. (2) Use...
-
Steve invests in a circus production. The cost includes an overhead of $36,000, plus production costs of $5000 per performance. A sold-out performance brings in $8000. Let x represent the number of...
-
chidrens tickets are $20.00 adult tickets are $43.00 attendance was 1,100 profit was $35,800 how many chidren and how many adults
-
Analyze output. What do the measures tell you? Is your data skewed? Does it exhibit kurtosis? What is the interquartile range? What insights about the data you have chosen do you derive from this...
-
In the circuit below, V_s=15V, R1 = 15 ohm, R2 = 15 ohm, R3 =15 ohm, and R4 = 15 ohm. Vs +1 www R1 R2 www R3 R4 1. Determine R_Th for the Thvenin equivalent circuit. Enter your answer in Ohms,...
-
You are the newly appointed tax practitioner to complete Emilys tax return and have downloaded the prefill report for Emilys tax return (hint, you can read what a prefill report is here (Links to an...
-
The Object class equals() method takes ____________. a. No arguments b. One argument c. Two arguments d. As many arguments as you need
-
In object-oriented programming terminology, an unexpected or error condition is a(n)____________. a. Anomaly b. Exception c. Deviation d. Aberration
-
A complete list of the disk drive plus the hierarchy of directories in which a file resides is its ____________. A. Directory B. Folder C. Path D. Delimiter
-
Extracts from the ledgers of Hall Ltd have provided the following information for 2009 and 2010. Sales revenue 2009 Sales revenue 2010 Purchases 2009 Purchases 2010 Expenses 2009 Expenses 2010...
-
(a) Explain why there are always problems at the year-end in the assessment of the costs associated with electricity, gas, and telephone. (b) Using the information below, prepare the appropriate...
-
Arthur Moment set up a table-making business, Forlegco, on 1 July 2010. He had 10,000 available to invest, which is the amount he estimated was required for setting up costs. In the first month of...
Study smarter with the SolutionInn App