954,505 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Recursive Fibonacci

hi there, i also have an emergency home work

it about Fibonnaci recursive

the Output is should be like this :
--------------------------------------------------
First number of the fibonnaci : 3

The Fibonacci Lines are : 3 4 7 11 18 29 ...
----------------------------------------------------

i want the result is until 10 lines

i try all i do to finish this task, but always failed.

can anyone help me?

andrisetia
Newbie Poster
1 post since Apr 2007
Reputation Points: 10
Solved Threads: 0
 

make a new post and don't hijack another person's thread... read the forum rules. also before you post that question, you need to make an attempt at completing it first.

mariocatch
Junior Poster
103 posts since Apr 2007
Reputation Points: 11
Solved Threads: 17
 

use
fibonaci(int n)
{
if(n==1) return o;
if(n==2) return 1;
return fibonaci(n-1)+fibonaci(n-2);
}

srinath.sec
Newbie Poster
7 posts since Apr 2007
Reputation Points: 10
Solved Threads: 0
 
use fibonaci(int n) { if(n==1) return o; if(n==2) return 1; return fibonaci(n-1)+fibonaci(n-2); }


I think you need to read these: http://www.daniweb.com/techtalkforums/announcement8-2.html
http://www.daniweb.com/techtalkforums/announcement8-3.html

Not only that, but I know for a fact that the code won't work.

John A
Vampirical Lurker
Team Colleague
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
 

hey,
i will like you to post the code you have written so that i can help with it... i have written it and it worked but i want to make sure you know it and not just copy mine... i will tell you where the mistakes are and where you should make ammendments.....
trust me

addicted
Junior Poster in Training
57 posts since Mar 2007
Reputation Points: 10
Solved Threads: 0
 

how to show this ?

Input number [1-40]: 3
3 first fibonacci : 1 1 2

i have no idea 'bout that...

vannthns
Newbie Poster
1 post since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

void main()
{
int n,i,j,k,s;
printf("give your choice from 1-40")
scanf("%d",&n);
i=0,j=1;
if(n==1)
{
printf("%d",i);
break;
}
if(n==2)
{
printf("%d %d ",i,j);
break;
}
else
(
printf("%d %d ",i,j);
for(k=0;k

shruti22
Newbie Poster
1 post since Jul 2010
Reputation Points: 10
Solved Threads: 0
 

how this function is used. i m so confused n not getting the proper result

akki30
Newbie Poster
1 post since Jul 2010
Reputation Points: 10
Solved Threads: 0
 
how this function is used. i m so confused n not getting the proper result


Fibonacci number is calculated in pretty straightfoward way:
[IMG]http://upload.wikimedia.org/math/0/c/e/0cebc512d9a3ac497eda6f10203f792e.png[/IMG]
No additional comments needed...

0x69
Junior Poster
131 posts since Apr 2010
Reputation Points: 51
Solved Threads: 9
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You