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...

compute the nth mumber in the fibonacci sequence?

Answer Posted / ravi kumar gupta

#include<stdio.h>
#include<conio.h>

void main()
{
int n;
void fib(int n);
clrscr();

printf("Enter any no.");
scanf("%d",&n);
clrscr();

printf("Hit any key to continue");
getch();
clrscr();
printf("Fibonacci of %d is \n");
fib(n);

getch();

}
void fib(int n)
{
static int x,y;
int temp;
if(n<=1)
{
x=0;
y=1;
}
else
{
fib(n-1);
temp=y;
y=x+y;
x=temp;
}
printf(" %d\n",x);

return;
}

Is This Answer Correct ?    10 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the code in while loop that returns the output of given code?

1893


will u please send me the placement papers to my mail???????????????????

1793


How we can insert comments in a c program?

1069


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

3913


Which one would you prefer - a macro or a function?

1032


What does c mean before a date?

1100


List the variables are used for writing doubly linked list program.

1966


Write a code of a general series where the next element is the sum of last k terms.

985


How can I determine whether a machines byte order is big-endian or little-endian?

1000


What is c language used for?

922


What is 1f in c?

2569


Why doesnt long int work?

977


Can we access array using pointer in c language?

1040


Why are algorithms important in c program?

1067


What is %s and %d in c?

971