944,103 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 33073
  • C RSS
Apr 18th, 2007
0

Re: C++ programming Home Work HELP...(Fibonnaci)

Expand Post »
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?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
andrisetia is offline Offline
1 posts
since Apr 2007
Apr 18th, 2007
0

Re: C++ programming Home Work HELP...(Fibonnaci)

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.
Reputation Points: 11
Solved Threads: 17
Junior Poster
mariocatch is offline Offline
103 posts
since Apr 2007
Apr 19th, 2007
0

Re: C++ programming Home Work HELP...(Fibonnaci)

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

Re: C++ programming Home Work HELP...(Fibonnaci)

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/techtalkforum...cement8-2.html
http://www.daniweb.com/techtalkforum...cement8-3.html

Not only that, but I know for a fact that the code won't work.
Team Colleague
Reputation Points: 2240
Solved Threads: 338
Vampirical Lurker
John A is offline Offline
5,055 posts
since Apr 2006
Apr 19th, 2007
0

Re: Recursive Fibonacci

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
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
addicted is offline Offline
57 posts
since Mar 2007
Oct 28th, 2009
0
Re: Recursive Fibonacci
how to show this ?

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

i have no idea 'bout that...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
vannthns is offline Offline
1 posts
since Oct 2009
Jul 18th, 2010
0

reply

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<n-1<k++)//as two values have already written;
{
s=i+j;
i=j;
j=s;
printf(" %d",s);
}
}
}
Reputation Points: 10
Solved Threads: 0
Newbie Poster
shruti22 is offline Offline
1 posts
since Jul 2010
Jul 23rd, 2010
0
Re: Recursive Fibonacci
how this function is used. i m so confused n not getting the proper result
Reputation Points: 10
Solved Threads: 0
Newbie Poster
akki30 is offline Offline
1 posts
since Jul 2010
Jul 23rd, 2010
0
Re: Recursive Fibonacci
Click to Expand / Collapse  Quote originally posted by akki30 ...
how this function is used. i m so confused n not getting the proper result
Fibonacci number is calculated in pretty straightfoward way:

No additional comments needed...
Reputation Points: 51
Solved Threads: 9
Junior Poster
0x69 is offline Offline
130 posts
since Apr 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: quick sort recursive c program
Next Thread in C Forum Timeline: Converting char to int





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC