All rights are reserved by Niteesh Kumar.. Theme images by Storman. Powered by Blogger.

Followers

Total Pageviews

Blog Archive

Follow by Email

Translate

Friday, 9 January 2015

program to generate Fibonacci Series.


#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

longint a=0,b=1,c,n;

cout<<"enter any limit=";

cin>>n;

cout<<a<<" " <<b<<" ";

for(int i=3;i<=n;i++)

{c=a+b;

cout<<c<<" ";

a=b;

b=c; }

getch();

}

OUTPUT

enter any limit=20

0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584

0 on: "program to generate Fibonacci Series."