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

write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays

2242


explain what is an endless loop?

1082


Array is an lvalue or not?

1119


What is an identifier?

1032


How do I swap bytes?

1067


Write a program with dynamically allocation of variable.

1120


Ow can I insert or delete a line (or record) in the middle of a file?

1001


Why & is used in scanf in c?

1098


What is self-referential structure in c programming?

1212


plz let me know how to become a telecom protocol tester. thank you.

2189


If the size of int data type is two bytes, what is the range of signed int data type?

1021


What is the -> in c?

1007


Explain how can I right-justify a string?

1041


Explain the meaning of keyword 'extern' in a function declaration.

1155


Which is best linux os?

1024