# Question: use pipes create a program in c where pipes are...

###### Question details

**--Use Pipes--**

Create a **program in C** where
**pipes** are used. The program's execution line
should indicate the number of children and the elements of an array
that will compute their sums. The number of children can only be 1,
2, or 3.

Example for executing in linux terminal:

**./program_name 3 1 2 4 5 6 7** (3 indicates the
number of children, 1,2,4,5,6,7 is the array).

With this input, it will assume the parent has pid 3, child 1 to
have pid 4, and child 2 to have pid 5, and child 3 to have pid 6.
Assuming this it will output the following:

**I am the parent with pid: 3, sending the array: 1, 2, 4,
5, 6, 7**

**I am the child with pid: 4, adding the array 1, 2 and
sending partial sum 3**

**I am the child with pid: 5, adding the array 4, 5 and
sending partial sum 9**

**I am the child with pid: 6, adding the array 6, 7 and
sending partial sum 13**

**I am the parent of pid 4, pid 5, and pid 6 and got the
partial results 3, 9, 13 so final result is 25.**

If the child size was 2, then each child instead would add 3 elements, or just 1 child would add all 6 elements of the array.

Another way of putting it

When I enter the single line: **./program_name 3 1 2 4 5 6
7** in the linux terminal to start my program, I want the
"**3**" to indicate the number of children processes
that can occur. The number of children can either be 1, 2, or 3.
The "**1 2 4 5 6 7**" are just elements that will be
put into an array. The array size can always be 6. After the
command is entered, the following statements should be
returned:

**I am the parent with pid: 3, sending the array: 1, 2, 4,
5, 6, 7**

**I am the child with pid: 4, adding the array element's
1, 2 and sending their partial sum 3**

**I am the child with pid: 5, adding the array element's
4, 5 and sending their partial sum 9**

**I am the child with pid: 6, adding the array element's
6, 7 and sending their partial sum 13**

**I am the parent of pid 4, pid 5, and pid 6 and got the
partial results 3, 9, 13 so the final result is 25.**