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

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a=0,b=1,c=0,n;
cout<<"Enter the number: ";
cin>>n;
cout<<a<<" "<<b<<" ";
for(int i=1;i<=n;i++)
{
c=a+b;
a=b;
b=c;
cout<<c<<" ";
}
getch();
}

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the c++ code?

1225


In c++, what is the difference between method overloading and method overriding?

1196


How can you tell what shell you are running on unix system?

1163


Why isn't sizeof for a struct equal to the sum of sizeof of each member?

1059


How to allocate memory dynamically for a reference?

1095


What is the best way to declare and define global variables?

1415


Can you pass a vector to a function?

1032


What are stacks? Give an example where they are useful.

1122


Write a short code using c++ to print out all odd number from 1 to 100 using a for loop

1084


How can virtual functions in c++ be implemented?

1200


Explain about Virtual Function in C++?

1087


Why #include is used?

1118


What is c++ used for in games?

1240


When do we use copy constructors?

1133


Why do we use constructor?

1114