Write a program Fibonacci series

//this is a program Fibonacci series
#include<iostream>
#include<conio.h>

using namespace std;

int main()
{
int f1=0,f2=1,f3=0,num,i;

cout<<"\n\nEnter the number: ";
cin>>num;

//displaying the fibbonacci series
cout<<"\n\nDisplaying the fibbonaccies series: \n\n";

for(i=1;i<=num;i++)
{
cout<<" "<<f3;
f1=f2;
f2=f3;
f3=f1+f2;
}

return 0;
}

Previous
Next Post »