Saturday, January 26, 2013

C++ Program to show Fibonacci Series

11:54 AM

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

Written by

We are one of the initiators of the development of information technology in understanding the need for a solution that is familiar and close to us.

0 comments:

Post a Comment

 

© 2013 Klick Dev. All rights resevered.

Back To Top