Fibonacci Program

Hi guys,
I need to write a program to display the first 30 Fibonacci numbers using 1 loop. I'm not sure what a Fibonacci number is and so I'm drawing a blank. If anyone would be willing to help me understand what a Fibonacci number is and get an idea on how to go about writing this program, that would be greatly appreciated.
Fibonacci numbers start at 0, then 1, then it is each number that is the sum of the last two.

0, 1, 1, 2, 3, 5, 8, 13, 21 etc… or N = (N-1) + (N-2)

To do this in a single loop, you should use a recursive function.
The Fibonnacci sequence is often used to demonstrate the topic of recursion. However, there's no particular need to use recursion, (unless that is the current topic being studied).

A simple loop with a few lines of code (including the cout statement) will do the job just as well.
That's true, a loop will suffice. I think because it is often used to demonstrate recursion is why that's the first thing that came to mind.
Topic archived. No new replies allowed.