You are on page 1of 2

#include <iostream.

h>
#include<conio.h>
int f1=1,f2=1,f3;
class fib
{
public:
void calculation()
{
f3=f2+f1;
cout<<f3<<endl;< span=""></f3<<endl;<>
f1=f2;
f2=f3;
}
};
void main()
{
clrscr();
int n;
fib obj;
cout<<"enter the value of n:";
cin>>n;
for(int i=0;i<n;i++)< span=""></n;i++)<>
{
obj.calculation();
}
getch();
}
Output:
Enter the value of n: 5
2

3
5
8
13

You might also like