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 / akshara

#include<stdio.h>
#include<conio.h>
void main()
{
int f=0,s=1,t,n,i;
clrscr();
printf("\nENTER THE VALUE OF N\n");
scanf("%d",&n);
if(n==1)
printf("FIBONACCI NUMBER IS 0");
else if(n==2)
printf("FIBONACCI NUMBER IS 1");
else
{
for(i=3;i<=n;i++)
{
t=f+s;
f=s;
s=t;
}
printf("\nFIBONACCI NUMBER IS %d",t);
}
getch();
}

Is This Answer Correct ?    6 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)

1043


What is difference between array and structure in c?

1200


Does c have class?

1127


which is an algorithm for sorting in a growing Lexicographic order

1815


Is return a keyword in c?

1096


The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration

1110


What is a lookup table in c?

1126


What is || operator and how does it function in a program?

1101


i have to apply for the rbi for the post of officers. i need to know abt the entrance questions whether it may be aps or techinical....

1986


What is the time and space complexities of merge sort and when is it preferred over quick sort?

1087


Explain Basic concepts of C language?

1169


How main function is called in c?

1135


Explain about block scope in c?

1099


How can I change their mode to binary?

1130


how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?

1948