Question: The Fibonacci series 0, 1, 1, 2, 3, 5, 8, 13, 21, begins with the terms 0 and 1 and has the property that
The Fibonacci series 0, 1, 1, 2, 3, 5, 8, 13, 21, … begins with the terms 0 and 1 and has the property that each succeeding term is the sum of the two preceding terms.
a) Write a method fibonacci(n) that calculates the nth Fibonacci number. Incorporate this method into an application that enables the user to enter the value of n.
b) Determine the largest Fibonacci number that can be displayed on your system.
c) Modify the application you wrote in part (a) to use double instead of int to calculate and return Fibonacci numbers, and use this modified application to repeat part (b).
Step by Step Solution
3.43 Rating (166 Votes )
There are 3 Steps involved in it
a Here is a simple implementation in Python python def fibonaccin a b 0 1 for i in rangen a b b a b ... View full answer
Get step-by-step solutions from verified subject matter experts
