and the code that i wrote works just fine
Expand|Select|Wrap|Line Numbers
- int x1=1;
- int x2=1;
- int x3;
- int x;
- cout<<"please enter the number "<<endl;
- cin>>x;
- cout<<x1<<endl<<x2<<endl;
- while (x2<x)
- {
- x3=x1+x2;
- x1=x2;
- x2=x3;
- cout<<x1<<endl<<x2<<endl;
- }
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