Ask Question
12 July, 07:40

Design a recursive version of the Euclidean algorithm

+4
Answers (1)
  1. 12 July, 11:03
    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?
Find an answer to your question ✅ “Design a recursive version of the Euclidean algorithm ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers