GCD and Fibonacci Series

GCD

#include
#include
using namespace std;

int gcd(int a, int b);

int main()
{
     int a,b;
     cout<<"Greatest Common Divisornn";   
     cin>> a;
     cin>> b;
     cout<< "Greatest common divisior of "<      getch();
}

int gcd(int a, int b)
{
    while (a != b)
     {
          if (a > b)
               a -= b;
          else
               b -= a;
     }
     return a;
}

 #########################################################

 FibSeries

#include
#include
using namespace std;

int fib(int a);

int main()
{
    int a;
    cout<<"Enter an integer: ";
    cin>>a;
    cout<<"The fibonnaci Series of "<     getch();
}

int fib(int a)
{
    int b;
    if(a==1)
    return 1;
    else if(a==0)
    return 0;
    else
    b = (fib(a-1)+fib(a-2));
    return b;

}
 

 

January 19, 2009 + Posted in Uncategorized +


Comments »

The URI to TrackBack this entry is: http://emptyminds.blogsome.com/2009/01/19/gcd-and-fibonacci-series/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.