Showing posts with label write a program to print fibonacci series. Show all posts
Showing posts with label write a program to print fibonacci series. Show all posts

Tuesday, 3 October 2017

Write a program to print fibonacci series


C++ Program to print the Fibonacci series

In this program ,we learn you how to print Fibonacci series in c++ programming language
an n term.



You must have basic knowledge of  C++ programming language and variable  ,while loop and if..ealse and for loop.



What is Fibonacci Series?

The Fibonacci series is which every number is sum of previous two number.
that is known as Fibonacci series.


Example of Fibonacci series

Fibbonacci series is ...1 , 1 , 2 , 3 , 5 , 8 , 13, etc.



Example 1 Fibonacci series to n number


#include<iosteam>
#include <conio.h>
int main ( )
 {
  int num, first=0,second=1,sum,i ;
cout<<"please enter the number";
   cin>>num;
cout <<"first"num<<"terms of Fibonacci series";

for(i=1;i<=n;i++)
   {
  if(i < = 1)
 sum=i;
}
else
{

    sum=first+second; 
    first=second;
    second=sum;
}
cout <<onum <<sum;
return 0;
getch ();
}
}

output
------------------------------------
please enter the number
10
10 terms of Fibonacci series
0 1 1 2 3 5 8 13 21 34.


--------------------------------------------
You should have basic programming knowledge
like syntax and variable and if else statement or for loop that is must learn before starting
the program.
The people who want to learn programming language. this website very beneficial for those people.