Please use C language to figure out problems
Problem 1 (15 points)
The Fibonacci sequence is the series of numbers 0, 1, 1, 2, 3, 5, 8, . . . Formally, it is expressed as
fib0 = 0
fib1 = 1
fibn = fibn-1 + fibn-2.
Write a complete C program that spawns n process which cooperate to compute and print the first n Fibonacci numbers, where n is given as a command-line argument, such that each process computes and prints only one number in the sequence. The processes must terminate in reverse order of creation. Be careful to synchronize the processes so that the numbers are printed in the correct order. For instance:
1 $ ./a . out 2
2 0 1
3 $ ./a . out 3
4 0 1 1
5 $ ./a . out 4
6 0 1 1 2
7 $ ./a . out 5
8 0 1 1 2 3
9 $ ./a . out 6
10 0 1 1 2 3 5
11 $ ./a . out 7
12 0 1 1 2 3 5 8
13 $ ./a . out 12
14 0 1 1 2 3 5 8 13 21 34 55 89
15 $
Problem 2 (15 points)
This exercise is an extension of project 2 (problem 2). Specifically, extend your solution so that the lines read represent Linux commands to be executed. After the command line is tokenized and stored in the array of arguments, rather than printing it, fork a child and then have the parent wait for the child and have the child execvp the Linux command using the argument vector. This time print a prompt for input to standard error, as shown below. For instance:
1 $ gcc ourshell. c −o ourshell
2 $ ./ourshell
3 ourshell> date
4 Wed Feb 10 1 0 : 5 9 : 2 7 EST 2016
5 ourshell> hostname
6 cpssuse07
7 ourshell> uname
8 Linux
9 ourshell> uname −a
10 Linux cpssuse07 3.11.10−29−desktop #1 SMP PREEMPT Thu Mar 5 1 6 : 2 4 : 0 0 ←֓
UTC 2015 (338 c513 ) x86_64 x86_64 x86_64 GNU/Linux
11 ourshell> wc −l
12 hello world
13 good
14 bye
15 ^D
16 3
17 ourshell> ls −l −a ~/.profile
18 −rw−−−−−−− 1 lucia wheel 2087 Aug 11 2015 . profile
19 ourshell>
20 ourshell> cal 9 1752
21 September 1752
22 Su Mo Tu We Th Fr Sa
23 1 2 14 15 16
24 17 18 19 20 21 22 23
25 24 25 26 27 28 29 30
26 ourshell> gcc parsestring. c −o parsestring
27 ourshell> ./parsestring
28 one two three four
29 : one :
30 : two :
31 : three:
32 : four :
33 ls −a −l myfile
34 : ls :
35 :−a :
36 :−l :
37 : myfile:
38 ^D
39 ourshell> lsss
40 ./ourshell: lsss : No such file or directory
41 ourshell> ./parsestring1
42 ./ourshell: ./parsestring1: No such file or directory
43 ourshell> ^D
44 $