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

Explain the difference between c++ and java.

1055


Write a Program for find and replace a character in a string.

1013


Am studying basic c++ programming, have been given the following assignment. Design a linear program to calculate the maximum stress a material can withstand given a force and a diameter of a circle. To find the required area pi should be defined. Have most of the program sorted out but am at a loss as to how to show the calculations required. Can anyone help?

2128


Write down the equivalent pointer expression for referring the same element a[i][j][k][l]?

1192


What is private, public and protected inheritance?

1032


What return value must conversion operators have in their declaration?

1028


How the keyword struct is different from the keyword class in c++?

986


What can I use instead of namespace std?

1071


Write some differences between an external iterator and an internal iterator? Describe the advantage of an external iterator.

1012


Why would you use pointers in c++?

1090


Which operations are permitted on pointers?

944


How should a contructor handle a failure?

1118


What is the arrow operator in c++?

948


What is a syntax in c++?

1104


What are features of c++?

1100