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

Simplest one:

#include <iostream>

using namespace std;

int main()
{
int x, a = 0, b = 1, i, z;
cout << "Lets Start!" << endl;
cout << "No. of elements in the series = ";
cin >> x;
cout << "Series: " << endl;
for(i = 0; i < x; i++){
z = a + b;
a = b;
b = z;
cout << z << endl;
}

return 0;
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. Your program should work for squares of all side sizes between 1 and 20. --- │ │ │ │ │ │ ---

2156


What is the hardest coding language to learn?

1088


What is the difference between #import and #include?

1104


How can we access protected and private members of a class?

1162


Can I make ios apps with c++?

1097


How new/delete differs from malloc()/free?

1190


Is c++ a good beginners programming language?

1125


What is difference between rand () and srand ()?

1149


Inline parameters : What does the compiler do with the parameters of inline function, that can be evaluated in runtime ?

2588


What is a node class in c++?

1114


What is purpose of abstract class?

1127


Why do we use using namespace std in c++?

1127


What is the equivalent of Pascal's Real a) unsigned int b) float c) char

1061


Explain the auto storage classes in c++.

1156


Define the process of handling in case of destructor failure?

1117