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

#include "stdafx.h"
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{

int range = 0;
cout<<"Enter the range of numbers\n";
cin>>range;

for(int i = 0;i<range;i++)
{

int outNum[100];
if((i==0)||(i==1))
{
outNum[i] = i;
cout<<outNum[i]<<" ";

}
else
{
outNum[i] = outNum[i-1] + outNum[i-2];
cout<<outNum[i]<<" ";

}
}

return 0;
}

Is This Answer Correct ?    13 Yes 33 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program that takes a 5 digit number and calculates 2 power that number and prints it.

2574


How much maximum can you allocate in a single call to malloc()?

1108


Is c++ still in demand?

1153


What is a buffer c++?

1066


what is C++ objects?

1198


What are the differences between new and malloc?

1137


What is the sequence of destruction of local objects?

980


In a function declaration, what does extern mean?

1066


Can we make any program in c++ without using any header file and what is the shortest program in c++.

1135


Why struct is used in c++?

1128


What does std :: flush do?

1141


Can manipulators fall in love?

1017


What is the use of bit fields in structure declaration?

987


Explain the benefits of proper inheritance.

1152


Show the declaration for a static member variable.

1001