Hi,

I was hoping someone could shed some light on this for me. I am stuck on an assignment. I have spent 3 weeks on it and have almost finished it. I have so much going through my head at the moment I just need some help. Please. I do not expect you to do it all for me!! I have got this far on my own, I just need a little advice and a little help, as I really dont understand it and am having alot of trouble getting my head around it.

This is what the example looks like when it is finished (the parts in bold are what I need to work out). (the other parts I have done seem to work out ok).

Program computes the first n Fibonacci numbers and ratios of
consecutive ones. Enter n: 11
~~~~~~~~~~~~~~~~~~~~~~~~
Fibonacci
number Ratio
~~~~~~~~~~~~~~~~~~~~~~~~
1
1 1.000000000000
2 0.500000000000
3 0.666666666667
5 0.600000000000
8 0.625000000000
13 0.615384615385
21 0.619047619048
34 0.617647058824
55 0.618181818182
89 0.617977528090
~~~~~~~~~~~~~~~~~~~~~~~~

My main problems are that I cannot work out how to display them on the same line as well as do not know a formula of how to work out the ratio. I have used a for loop for the fibonacci numbers and it is ok. But I am really stuck on the ratio and displaying it.
Again, any help would be appreciated. Thank you.

hi a2008

if you divide two consecutive Fibonaccis, say F20 / F19 = 6765/4181 = 1.618033963, the ratio converges to the famous golden ratio (1 + sqrt(5))/2 = 1.61803398874989484820458683 . . .

krs,
cliff

Hi,

I was hoping someone could shed some light on this for me. I am stuck on an assignment. I have spent 3 weeks on it and have almost finished it. I have so much going through my head at the moment I just need some help. Please. I do not expect you to do it all for me!! I have got this far on my own, I just need a little advice and a little help, as I really dont understand it and am having alot of trouble getting my head around it.

---------------
My main problems are that I cannot work out how to display them on the same line as well as do not know a formula of how to work out the ratio.

It took 3 weeks just to print out the fibb series? I would've asked for help after the second day for something that simple.

Assuming it'll take you 3 more weeks before asking your instructor, the ratio is the current number divided by the previous number.

Thank you. Sorry should have been more specific. I know how to calculate the ratio. I just cannot work out how to calculate them into my code, also to get them on the same line. As fo asking my instructor for help, he is virtually non-existant. I am doing this externally and sent him varios email throughout the year and have only got a reply of he is too busy at the moment to help, please do more research.

Post the code you have so far, it's easier to give advice that way. (and if you want to score some credit, use [code=cpp] //your code here [/code] tags)

This article has been dead for over six months. Start a new discussion instead.