Fibonacci number on Wiki
http://en.wikipedia.org/wiki/Fibonacci_number
Code:
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int power(int a, int b)
{
int c=a;
for (int n=b; n>1; n--) c*=a;
return c;
}
double power(double a, int b)
{
float c=a;
for (int n=b; n>1; n--) c*=a;
return c;
}
int main()
{
double first,c1,c2,r1,r2,r3; int r,l;
first=0.4472135955; c1=1.618033989; c2=-0.6180339887;
cout<< " Enter long The series ";
cin>>l;
for (int i=1; i<l; i++)
{
r1=power(c1,i);
r2=power(c2,i);
r3= r1-r2;
r= first*r3;
cout<<r<<",";
}
cout <<endl;
system("pause");
return 0;
}