Question: I need a c++ code for these questions: 1) write a code to compute the greatest common divisor of two integers (do this with recursion

I need a c++ code for these questions: 1) write a code to compute the greatest common divisor of two integers (do this with recursion ....... no loops).

example:- int gcd(int a, int b) { return 1; } 2) write the "extended" GCD algorithm, which returns gcd (a,b), but also sets u and v such that ua + vb = gcd (a,b).

example:- int xgcd(int a, int b, int& u, int& v) { return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!