Question: Rewrite the gcd function based on the following observations (arrange so that a>b ): a. gcd(a,b)=2gcd(a/2,b/2) if a and b are both even. b. gcd(a,b)=gcd(a/2,b)
Rewrite the gcd function based on the following observations (arrange so that a>b ): a. gcd(a,b)=2gcd(a/2,b/2) if a and b are both even. b. gcd(a,b)=gcd(a/2,b) if a is even and b is odd." c. gcd(a,b)=gcd(a,b/2) if a is odd and b is even. d. scd(a,b)=gcd((a+b)/2,(ab)/2) if a and b are both odd. Write a main function to test your gcd function. Upload your source code to Canvas with a file name having the following pattern firstName_lastName_Lab3.cpp Please upload the source file with.cpp extension only. Do not upload .zip file Note: The reminder is zero when even number is divided by 2 . The reminder is 1 when odd number is divided by 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
