Ask Question
19 May, 01:35

Design a recursive version of the Euclidean algorithm

+1
Answers (1)
  1. 19 May, 03:18
    0
    Here's a recursive Python program that finds the greatest common denominator:

    #!/usr/bin/python

    import sys

    def gcdR (x, y):

    if (y):

    return (gcdR (y, x % y))

    return x

    if (__name__ = = "__main__"):

    x = max (int (sys. argv[ 1 ]), int (sys. argv[ 2 ]))

    y = min (int (sys. argv[ 1 ]), int (sys. argv[ 2 ]))

    print gcdR (y, x % y)

    sys. exit (0)
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Design a recursive version of the Euclidean algorithm ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers