Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


i want explaination about the program and its stack reprasetaion

fibbo(int n)
{
if(n==1 or n==0)
return n;
else
return fibbo(n-1)+fibbo(n-2);
}
main()
{
fibbo(6);
}

Answers were Sorted based on User's Feedback



i want explaination about the program and its stack reprasetaion fibbo(int n) { if(n==1 or n==0..

Answer / abdur rab

#include <stdio.h>

int fibonacci ( int nNumber )
{
if ( ( nNumber == 0 ) || ( nNumber == 1 ) ) return
( nNumber );
return fibonacci ( nNumber -1 ) + fibonacci (
nNumber - 2 ) ;
}


int main ( int argc, char* argv[] )
{
printf ( "\n The Fibnoci value :%d", fibonacci (
5 ) );
return ( 1 );


Other than the logical or, everyting is perfect, the
function will recursivel bubble down and for this value it
ud become like this if u copy this to a notepad, with
formating, it ud be easy to understand

4 +
3

3 + 2
2 + 1

2 + 1 1 + 0
1 + 0 ( will return 1 )

1 + 0 ( all others will return 1 )

Is This Answer Correct ?    1 Yes 0 No

i want explaination about the program and its stack reprasetaion fibbo(int n) { if(n==1 or n==0..

Answer / vignesh1988i

here the return function will give an error message or it
will only take the first function (ie) fibbo(n-1) since
after return this is the first recursive function
called.... so this altast return 1 to the main program....
that's all.... as for as i know this will be the
procedure...... and then the "or" must not be used .. only
logicalOR must be used ||.........

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More C Interview Questions

Differentiate between functions getch() and getche().

0 Answers  


What is putchar() function?

0 Answers  


What is calloc malloc realloc in c?

0 Answers  


difference between memcpy and strcpy

1 Answers  


I have a varargs function which accepts a float parameter?

0 Answers  


Explain what is output redirection?

0 Answers  


post new interiew question and aptitude test papers

1 Answers  


What are pointers?

0 Answers   Accenture, Tavant Technologies, Zensar,


x=2,y=6,z=6 x=y==z; printf(%d",x)

13 Answers   Bharat, Cisco, HCL, TCS,


how to compare two strings without using strcmp() function??

1 Answers  


will the program compile? int i; scanf(ā€œ%dā€,i); printf(ā€œ%dā€,i);

3 Answers  


What is array of structure in c?

0 Answers  


Categories