To work the Fibonacci sequence you only need to keep track of the last two elements. So a simple swap/rotate is all you really need. Something like:
temp = f1;
f1= f1 + f2; // current fibonacci number...
f2 = temp;
There are a TON of formulas for calculations within the fibonacci sequence. So if the traditional method is too slow there are lots of others.
You can also use a nice recursive algorithm -- you should be able to search for this as it is a "prototypical" example of recursion and has been done by just about every computer science student on the planet earth and probably other planets as well.
Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.
Post your code like this:

Thanks.