Question: Dijkstra created an algorithm for finding the greatest common divisor (GCD) of a number based on the principle that if a number c divides a

Dijkstra created an algorithm for finding the greatest common divisor (GCD) of a number based on the principle that if a number c divides a and b, then it divides a - b. Below is the algorithm in C: int gcd(int m, int n)f if (m--n) else if (m>n) else return m; return gcd(m-n, n); return gcd (m,n-m); Create a subroutine, "gcd", that implements this algorithm. Note that this must be a recursive subroutine Also create a short "main" procedure to test the subroutine. The "main" procedure should prompt the user for two integers (to be typed in using standard input) and should print out the GCD of these numbers
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
