3/27/2016

C++ Program To Print The Fibonacci Series Upto Given Number Of Terms

#include<iostream>
using namespace  std;
int  main()
{
int  range, first  = 0,  second  = 1,  fibonicci;
cout  <<  "Enter the Range for Terms of Fibonacci Sequence "  <<  endl;
cin  >>  range;
cout  <<  "Fibonicci Series upto "  <<  range  <<  " Terms  "<<endl<<  endl;
for  (  int  c  = 0 ;  c  <  range  ;  c++  )
{
if  (  c  <= 1 )
fibonicci  =  c;
else
{
fibonicci  =  first  +  second;
first  =  second;
second  =  fibonicci;
}
cout  <<  fibonicci  <<"  ";
}
return  0;
}


www.programmingwithbasics.com

3 comments:

  1. Anonymous3/27/2016

    Good Work Abhi

    ReplyDelete
  2. Great work.Its very useful for beginners.Here iam introducing the best software company namely yiioverflow.A CUSTOM SOFTWARE DEVELOPMENT COPMANY.
    Yiioverflow-Yii2 development, WP development, Ionic Development, NodeJS development, Angular Development.

    ReplyDelete