Question: Find the gcd for the following two problems; use the pseudo code. int main GCD (a, b) {int gcd =0; if (a a) return gcd;
Find the gcd for the following two problems; use the pseudo code. int main GCD (a, b) {int gcd =0; if (a a) return gcd; r1 = a; r2 = b; r = mod(r1, r2); while r > 0 {r1 = r2; r2 = r; r = mod (r1, r2):} if (r == 0) {gcd = r2;}//safety return gcd;}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
