Programming Logics FORUMS

Full Version: Help in C++ -Fibonacci Series?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
Can you please tell me How can I made a Fibonacci Series in C++?
i hope this will help u...
Code:
#include<iostream>
using namespace std;
int main()
{
int x=0,temp=0,tem=0,count=1,size;
cout<<"ENTER THE SIZE OF FABONACCI SERIES : ";
cin>>size;
cout<<endl;
while (count<=size)
{
    if (count==2)
    temp=1;
    if(count%2!=0)
    {
        temp=x;
    }
    if (count%2==0)
    {
        tem=x;
    }
    x=tem+temp;
    
    cout<<"    "<<x;
    count++;
}
cout<<endl;
return 0;
}
nice solution
That's a different logic, that I came across for Fibonacci series in C++ programming language. Smile The logic is better and much faster than the normal ones, I mean the computational way. Wink I am obliged to have come across such a site to be among such programming experts. Big Grin
Its a good solution, But not like normal one. go to the C++ basic and know more relevant to that. Its good for you.
Reference URL's