Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   Fibonacci number and recursive function (http://www.go4expert.com/forums/fibonacci-recursive-function-t2006/)

hapa_at_1 26Nov2006 01:44

Fibonacci number and recursive function
i was looking for questions on while loops when i came across a problem that said write a program that displays fibonacci numbers
and the code that i wrote works just fine


int x1=1;
int x2=1;
int x3;
int x;
cout<<"please enter the number "<<endl;
while (x2<x)


but the second part of the question says write another program but this time using recursive funtion
can any body please explain that to me and also how can i change my program to become a recursive function
i can write this as a seprate funtion
but how to find the terminating if function and how to approach this problem using recursive I have an exam coming up please help as soon as possible

hapa_at_1 26Nov2006 01:49

Re: Fibonacci number and recursive function
i am using visual .net 2003 compiler and windows xp professsional

shabbir 27Nov2006 10:30

Re: Fibonacci number and recursive function
I would suggest instead of getting into a solution to particular problem you should understand how recursion is done and I would suggest you read
Recursion - Begining
Types of Recursion - Advanced

All times are GMT +5.5. The time now is 08:50.