Geekpedia Programming Tutorials






Fibonacci Sequence Generator

Generate the Fibonacci sequence for the specified amount of numbers, using a C function.

On Thursday, April 24th 2008 at 08:20 PM
By Andrei Pociu (View Profile)
-----   (Rated 0 with 0 votes)
Contextual Ads
More C Resources
Advertisement
  1. int Fibonacci(int n)
  2. {
  3.    int numA = 1, numB = 1, numC, i;
  4.    for (i = 3; i <= n; i++)
  5.    {
  6.       numC = numB;
  7.       numB += numA;
  8.       numA = numC;
  9.    }
  10.    return numB;
  11. }
Digg Digg It!     Del.icio.us Del.icio.us     Reddit Reddit     StumbleUpon StumbleIt     Newsvine Newsvine     Furl Furl     BlinkList BlinkList

Rate Rate this code snippet
Comment Current Comments
There are no comments.

Comment Comment on this tutorial
Name: Email:
Message:
Comment Related Source Code
There is no related code.

Comment Related Tutorials
There are no related tutorials.

Jobs C Job Search
My skills include:
Enter a City:

Select a State:


Advanced Search >>
Latest Tech Bargains

Advertisement

Free Magazine Subscriptions

Today's Pictures

Today's Video

Other Resources

Latest Download

Latest Icons