Thursday, 24 January 2013

fabonaci series till 10

//fib series till  10.

#include <iostream>

using namespace std;

int main()
{


    int a,b,c;
    a=0;
    b=1;
    int i;

    cout << a<< "\t" << b <<"\t" << a+b<< "\t";

            for(i=1; i<= 10;i++)
    {c=a+b;
        if(c<10)
        {cout << c << "\t";
        }
        a=b;
        b=c;
    }



    cin.get();
    return 0;
}

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Enterprise Project Management