Saturday, January 26, 2013

C++ Program to show Fibonacci Series

Fibonacci


Write a program , that prints all the Fibonacci numbers ,which are smaller than or equal to a number k(k≥2) ,which was entered by the user.
The Fibonacci numbers are a sequence of numbers,where then-th number of Fibonacci is defined as:
Fib(0)=0,
Fib(1)=1,
Fib(n)=Fib(n-1)+Fib(n-2) Usage :> Input of k:21 > Fibonacci numbers<=21:01123581321

Solution-


#include<iostream>

using namespace std;


 int main (void)
{
     
    int r=0,a=0,n,b=1,i,c;
    char redo;
    do
    {
         a=0;
         b=1;
     cout<<"enter the the value of n:";
     cin>> n;
     if(n>100){
     cout<<"enter some lessor value"<<endl;
     }
     else{
     cout<<a<<endl;
     for (i=0;i<=n;i++)
     {
     c=a+b;
     a=b;
     b=c;
     cout<<"serial no."<<i+1<<"==";
     cout<<a <<endl;
}     
      cout<<"enter y or Y to continue:";
           cin>>redo;
           cout<<endl<<endl;
}
           }
           while(redo=='y'||redo=='Y');
    
   
   system("pause");
    return 0;
}  


   

C++ program Fibonacci series



---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------




---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------


Fibonacci sequence in c++
Fibonacci Series - C / C++
c++ program to generate Fibonacci series
Fibonacci numbers c++
C++ Fibonacci program
How do i write a c++ code for a fibonacci sequence
Write the program for fibonacci in c++?
C++ Program to print the Fibonacci Sequence!
Write a program to implement the Fibonacci series
IT Certification Category (English)640x480

Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com


Top Online Courses From ProgrammingKnowledge

Python Course http://bit.ly/2vsuMaS
Java Coursehttp://bit.ly/2GEfQMf
Bash Coursehttp://bit.ly/2DBVF0C
Linux Coursehttp://bit.ly/2IXuil0
C Course http://bit.ly/2GQCiD1
C++ Coursehttp://bit.ly/2V4oEVJ
PHP Coursehttp://bit.ly/2XP71WH
Android Coursehttp://bit.ly/2UHih5H
C# Coursehttp://bit.ly/2Vr7HEl
JavaFx Coursehttp://bit.ly/2XMvZWA
NodeJs Coursehttp://bit.ly/2GPg7gA
Jenkins Course http://bit.ly/2Wd4l4W
Scala Coursehttp://bit.ly/2PysyA4
Bootstrap Coursehttp://bit.ly/2DFQ2yC
MongoDB Coursehttp://bit.ly/2LaCJfP
QT C++ GUI Coursehttp://bit.ly/2vwqHSZ