Collaboration Exercises 2

Exercise 1

The golden ratio is a number that is found frequently in nature. The ratio of a part to a whole often gives this number. For example, the ratio of your height to your height to the waist will be close to this number. So will the ratio of the length of your arm to the length up to your elbow.

The golden ratio can be approximated by the ratio of one Fibonacci number to the previous. As the FIbonacci numbers increase, the approximation gets closer. The series of ratios is:

1/1 = 1 2/1 = 2 5/2 = 1.5 8/5 1.6 13/8 = 1.625 21/13 = 1.615 ... Write a program that takes a number n and outputs the ratio of each sequential pairs of Fibonacci numbers up to the nth number. For each ratio after the first, print out the difference between the current ratio and the previous: 1 2 1 1.5 .5 1.6 .1 1.625 .025 1.615 .010 ...