Order For Similar Custom Papers & Assignment Help Services

Fill the order form details - writing instructions guides, and get your paper done.

Posted: March 20th, 2017

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: 2024 – Do my homework – Help write my assignment online
 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 – Research Paper Writing Help Service (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 – Research Paper Writing Help Service . 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 $

 Project 2 (problem 2)

2. This programming exercise is a modification of the problem above. The command-line arguments expected are the same, and the same errors should be handled in  the same manner. The difference is that this program must remove all occurrences of the first string in the second string, and the resulting string and the number of occurrences that were found/removed must be written to standard output.
The following are some sample, non-exhaustive test cases. Your program is expected to produce identical output. Do not prompt for input.
1 $ ./a . out hehe xxxheheheyyy −nooverlap
2 1
3 xxxheyyy
4 $ ./a . out hehe xxxheheheyyy
5 2
6 xxxyyy
7 $ ./a . out xx xxxheheheyyy
8 2
9 heheheyyy
10 $ ./a . out yy xxxheheheyyy −nooverlap
11 1
12 xxxhehehey
13 $ ./a . out qq xxxheheheyyy −nooverlap
14 0
15 xxxheheheyyy
16 $ ./a . out qq
17 Usage : string1 string2 [−nooverlap]
18 $ echo $?
19 1
20 $ ./a . out “” “”
21 Search string cannot be empty!
22 $ echo $?
23 1
24 $ ./a . out hello “”
25 0
26
27 $

Order | Check Discount

Paper Writing Help For You!

Special Offer! Get 20-25% Off On your Order!

Why choose us

You Want Quality and That’s What We Deliver

Professional Writers

We assemble our team by selectively choosing highly skilled writers, each boasting specialized knowledge in specific subject areas and a robust background in academic writing

Discounted Prices

Our service is committed to delivering the finest writers at the most competitive rates, ensuring that affordability is balanced with uncompromising quality. Our pricing strategy is designed to be both fair and reasonable, standing out favorably against other writing services in the market.

AI & Plagiarism-Free

Rest assured, you'll never receive a product tainted by plagiarism or AI-generated content. Each paper is research-written by human writers, followed by a rigorous scanning process of the final draft before it's delivered to you, ensuring the content is entirely original and maintaining our unwavering commitment to providing plagiarism-free work.

How it works

When you decide to place an order with Nurscola, here is what happens:

Complete the Order Form

You will complete our order form, filling in all of the fields and giving us as much detail as possible.

Assignment of Writer

We analyze your order and match it with a writer who has the unique qualifications to complete it, and he begins from scratch.

Order in Production and Delivered

You and your writer communicate directly during the process, and, once you receive the final draft, you either approve it or ask for revisions.

Giving us Feedback (and other options)

We want to know how your experience went. You can read other clients’ testimonials too. And among many options, you can choose a favorite writer.