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

Write the program for fibonacci in c++?

Answer Posted / tanneru chetan

#include<iostream.h>
#include<process.h>
#include<conio.h>
void main()
{
clrscr();
Start:
int n,a=0,b=1,c=0,i=1;
char w;
cout<<"Enter an positive integer to represnt the
nth term of the fibonnaci series: "<<endl;
cin>>n;
cout<<"The fibonacci series upto the "<<n<<"th term
is:"<<endl;
cout<<0<<endl<<1<<endl;
while(i<=n)
{
c=a+b;
cout<<c<<endl;
a=b;
b=c;
++i;
}
cout<<"Do you want to try again(Y/N):"<<endl;
cin>>w;
if(w=='Y' || w=='y')
{
goto Start;
}
else
{
exit(4);
}
getch();
}

Is This Answer Correct ?    14 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Mention the storage classes in c++.

1085


What is the basic concept of c++?

1016


What is wrapper class in c++?

1128


What is fixed in c++?

1044


Can a program run without main function?

1175


True or false, if you keep incrementing a variable, it will become negative a) True b) False c) It depends

2392


What is the difference between a declaration and a definition?

1124


Do class declarations end with a semicolon? Do class method definitions?

1156


How are the features of c++ different from c?

1109


What do nonglobal variables default to a) auto b) register c) static

1158


Differentiate between a constructor and a destructor in c++.

1021


Why is swift so fast?

1132


What is long in c++?

1254


What is the use of setfill in c++?

1081


Difference between a homogeneous and a heterogeneous container

1148