C++ language

Program Of Fibonacci
Previous Home Next

Program Of Fibonacci Series In C++

#include<stdio.h>
#include<conio.h>
void main()
{
int sum,f1,f2,n;
f1=o;
f2=1;
cout<<"\n Enter the range";
cout<<f1<<"/t"<<f2;
cout<"\n< the series is";
for(int i=2;i<=n;i++)
{
sum=f1+f2;
cout<< fib<<"/t";
f1=f2;
f2=sum;
}
}

Output:

Enter the range
12
0 1 1 2 3 5 8 13 21 34 55 89
Previous Home Next