#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,i,n,c;
a=0;
b=1;
cout << "Enter the number of terms : ";
cin>>n;
cout << a <<"\t"<<b<<"\t";
for(i=2;i<n;i++)
{
c=a+b;
a=b;
b=c;
cout<<c<<"\t";
}
getch();
}
Here you can find sample and simple c++ programs that are helpful for computer science students
No comments:
Post a Comment