#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
void fibonacci(int );
void main()
{
int n;
clrscr();
cout<<"Enter a digit to findout fibonacci around it's range";
cin>>n;
fibonacci(n);
getch();
}
void fibonacci(int x)
{
int a=0,b=1,c;
cout<<a<<"\t"<<b;
while(c<x)
{
c=a+b;
a=b;
b=c;
cout<<"\t"<<c;
}
}
Saturday, August 13, 2011
Fibonacci Series printing using Functions
Posted by
hari1991
at
9:50 AM
Tags :
Series
0 comments
Post a Comment