Recursive Function for Greatest Common Divisior

Discussion in 'C' started by babarsaed, Oct 9, 2007.

  1. babarsaed

    babarsaed New Member

    Joined:
    Oct 9, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Q.write programe for the greatest common divisor of integers X and Y is the largest interger the evenly divides both X and Y. write a recursive function gcd that returns tha greatest common divisior of X and Y. the gcd of X and Y is defined recursivly as follows: if Y is equal to 0. then gcd (X,Y) is X; otherwise gcd (X,Y) is gcd (Y,X%Y) whre % is the modulus Operator.
     
  2. DaWei

    DaWei New Member

    Joined:
    Dec 6, 2006
    Messages:
    835
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Semi-retired EE
    Location:
    Texan now in Central NY
    Home Page:
    http://www.daweidesigns.com
    No, thanks. That's YOUR assignment. We'll help you with your code, though.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice