The Fibonacci series has the following form: 0, 1,1,2,3,5,8…. It can be solved recursively fib(n)=fib(n-1) + fib(n-2) i.e the nth fibonacci number is defined as shown b the above expression. Write a function using recursion that calculates the nth recursive number. For instance fib(3) = 1 i.e 1 + 0 and fib(4) = 2 i.e 1 + 1. Tip; The base case: fib(0)=0 and fib(1)=1. Use your function in a main program where you ask the user to a number n and then you output the nth Fibonacci number

Current and Future Considerations for Health Care Delivery
December 31, 2016
For Essays Guru – Ethical issues
December 31, 2016
Show all

The Fibonacci series has the following form: 0, 1,1,2,3,5,8…. It can be solved recursively fib(n)=fib(n-1) + fib(n-2) i.e the nth fibonacci number is defined as shown b the above expression. Write a function using recursion that calculates the nth recursive number. For instance fib(3) = 1 i.e 1 + 0 and fib(4) = 2 i.e 1 + 1. Tip; The base case: fib(0)=0 and fib(1)=1. Use your function in a main program where you ask the user to a number n and then you output the nth Fibonacci number

a. Explain the following terms in the context of programming. (3 Marks) i. Program ii. Programming language iii. Programming paradigm b. Distinguish between syntax of a language and semantics of a language. (2 Marks) c. Describe the role of the following elements of an imperative programming language. (3 Marks) i. Declarative statements ii. Imperative statements iii. Program flow control statements d. In the program fragment shown below categorize each of the statements to the appropriate element in (c) above justifying your choice. (6 Marks) int factorial = 1; int argument =7; int counter = 1; while (counter <= argument){ factorial = factorial*counter; counter++; } e. Construct a comprehensive class diagram to depict the objects and relationships described below relating to a publishing house. (10 Marks) ? If two or more authors are under-taking the auditing same book, each author may get a different royalty percentage ? An author may have more than one book published and for each book, the royalty fee can differ ? Each book is edited by one or two editors, and the publisher may use in house editors on salary, or pay freelance editors a flat fee. f. Illustrate the main difference between imperative programming and functional programming by writing a definition of function factorial for each of the two paradigms. Where; factorial (n)=n x (n-1) x (n-2) x ……. x3 x2 x1; factorial (1)=1 and factorial (0)= 1 (6 Marks)

 

 

 

 

For a custom-written paper on the above topic, place your order now!

What We Offer
• On-time delivery guarantee
• PhD-level professionals
• Automatic plagiarism check
• 100% money-back guarantee
• 100% Privacy and Confidentiality
• High Quality custom-written papers