Hi everyone! This is my first post, and I'm quite a noob at C. I have a homework assingment I have to do, and I've thought on it a lot, but it's confusing me. Here's the exact problem given:
The Fibonacci number sequence is commonly used in mathematics and is commonly found in nature. Request that the user enter a number between 1 and 100 and have the program respond back which Fibonacci number corresponds. You must use loops and functions to solve this problem. Note, the formula can be found here:
Fibonacci number - Wikipedia, the free encyclopedia
For example the sequence is:
>>>Which Fibonacci number would you like to see?
>>>Please enter a number: 7
>>>Fibonacci number 7 is 21.
I'm guessing I just start it off requesting the user for input and then the number they input be plugged into the formula F(n)=F(n-1)+F(n-2)=F(0)+F(1), but with this if I entered in 10, i'd have to know the Fibonacci numbers for 9 and 8? and it'd be that pattern all way up to 100? Really don't know how I'd do that =(. Can anyone help me here or give me an similar example of some sort?