fibonacci Series in C++ Language with source code

#include<iostream.h>
#include<conio.h>
class fibo
{
   private:
      long int  a,b,c,i,no;
   public:
      void enter_number();
      void calcu_fibo();

};
void fibo :: enter_number()
{
    cout<<"Enter number for Display fibo Series:->"<<endl;
    cin>>no;
}
void fibo :: calcu_fibo()
{
     a=0;
     b=1;
    // cout<<a;
     //cout<<b;
     for(i=0;i<=no;i++)
     {
       c=a+b;
       cout<<c<<endl;
       a=b;
       b=c;
       c=a;
     }
     //cout<<c<<endl;
}

void main()
{
   clrscr();
   fibo f;
   f.enter_number();
   f.calcu_fibo();
   getch();

}
fibonacci Series in C++ Language with source code fibonacci Series in C++ Language with source code Reviewed by Unknown on 6:19:00 PM Rating: 5

No comments:

Powered by Blogger.