Question: in c++ language please 2. Prompt the user to input two positive integer a and b. (40pts) Write a recursive function int gcd(int a, int

in c++ language please

2. Prompt the user to input two positive integer a and b.

(40pts) Write a recursive function int gcd(int a, int b) to calculate the greatest common divisor (GCD) of a and b (assuming a < b).

(20pts) The function gcd(a,b) should print out the list of partial results of the module operations and the final result of gcd(a,b).

For example, a = 19, b = 83, the output of your program should be:

83 mod 19 = 7

19 mod 7 =5

7 mod 5 = 2

5 mod 2 = 1

2 mod 1 = 0

gcd(82,19) = 1

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!