HNDIT
Tuesday, December 18, 2012
FIBONACCI SERIES 3 PROGRAMME IN C++
#include<iostream.h>
void main()
{
int a=0,b=1,c=0,n;
cout<<"Enter the number of element required: ";
cin>>n;
cout<<a<<" "<<b<<" ";
for(int i=1;i<=n-2;i++)
{
c=a+b;
a=b;
b=c;
cout<<c<<" ";
}
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment