10/21/2015

C++ Program To Find Large Fibonacci Series

Problem :- Write A Program To Find Fibonacci  Series Of Large Amount Of Integer

Logic :- For Print Fibonacci Series We Use Simple Method .As we know that Fibonacci Series is start with Zero (0) and next Element is One Then we add previous two element and print next element of Fibonacci Series .

Example :- Fibonacci Series is up-to 10 Element is below 

Fibonacci Series :- 0 ,1 ,1 ,2 ,3 ,5 ,8 ,13 ,21 ,34 .

Explanation :- Fibonacci Series start with Zero and next element is one then first we print 0 and 1.
Now add two previous element and print then next element is 0+1=1.
repeat that process 
1+1=2
1+2=3
2+3=5
3+5=8
5+8=13
8+13=21
13+21=34

Done.

Solution :-

#include<iostream>
using namespace std;
int main()
{
  int n,a,b,i;
 
cout<<"How Many Term You Want To Check :\n";
  cin>>n;

  long long A[n];
  a=0;
  b=1;
  cout<<"The Fibonacci Series Is :\n";

  if(n<2)
  {
  A[0]=a; A[1]=b;
  cout<<A[0]<<" , "<<A[i];
  }
  else
  A[0]=a; A[1]=b;
 
cout<<A[0]<<" , "<<A[1]<<" , ";

  for(i=2;i<n;i++)
  {
  A[i]=A[i-1]+A[i-2];;
  cout<<A[i]<<" , ";
  }
return 0;

}

Output:-

C++ Program To Find Large Fibonacci Series

Ghanendra Yadav

Ghanendra Yadav

Hello, I Am Ghanendra Yadav Owner of This Blog, I am professional Blogger and Programmer. I Love Programming, Logo Making, And Banner Designing. My Highest Qualification is MCA From NIT Warangal. You Can Find Me On Social Media Through Below Link And If You Have Any Query Related To Programming And Other Subject Comment Below or You Can Mail Me I Will Try To Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

4 comments:

  1. Anonymous10/26/2015

    great job

    ReplyDelete
  2. Anonymous10/26/2015

    nice job dude

    ReplyDelete
  3. sir my suggetion is that include program complexity also

    ReplyDelete
    Replies
    1. Ok Bro Thanks For Visiting Next Time I will Remember Your requirement Thanks For Visiting Once Again

      Delete