Question: Extended Euclidian Algorithm Write code that asks for and gets two integers, then computes and displays their greatest common divisor using the Extended Euclidian Algorithm
Extended Euclidian Algorithm Write code that asks for and gets two integers, then computes and displays their greatest common divisor using the Extended Euclidian Algorithm (EEA). The EEA should be implemented as a function that takes two integers are arguments and prints their GCD.
proceedure EEA(int: a, b)
s = 0
old_s = 1
t = 1
old_t = 0
r = b
old_r = a
while9 r != 0)
q = old_r div r
old_r = r
r = old_r - q * r
old_s = s
s = old_s - q*s
old_t = t
t = old_t-q*t
print("GCD=" old_r)
return (t,s)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
