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

What are the characteristics of friend functions?

1073


Explain differences between new() and delete()?

1150


What is an iterator class in c++?

1195


What is the purpose of templates in c++?

1088


Difference between strdup and strcpy?

1252


how to connect with oracle 9i with server in socket program in c/c++

2397


What are its advantages and disadvantages of multiple inheritances (virtual inheritance)?

1244


Which programming language should I learn first?

1152


Is recursion allowed in inline functions?

1135


Explain the difference between struct and class in terms of access modifier.

1225


Can turbo c++ run c program?

1148


Write a Program for read a line from file from location N1 to N2 using command line arguments. Eg:exe 10 20 a.c

1336


Can I learn c++ without c?

1187


What is the need of a destructor? Explain with the help of an example.

1089


What are the uses of c++ in the real world?

1093