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

which is an algorithm for sorting in a growing Lexicographic order

1798


What is console in c language?

1093


Differentiate between Macro and ordinary definition.

1375


List a few unconditional control statement in c.

982


Explain how can I convert a string to a number?

1089


How can I write a function that takes a format string and a variable number of arguments?

1044


What is the condition that is applied with ?: Operator?

1125


shorting algorithmS

2251


If null and 0 are equivalent as null pointer constants, which should I use?

1207


What is a node in c?

971


What are different types of variables in c?

1060


Explain what is the difference between #include and #include 'file' ?

1018


How can I read data from data files with particular formats?

1040


What is wrong with this initialization?

1004


What does double pointer mean in c?

1161