Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a method called GreatestCommonDivisor that used Euclids algorithm as defi

ID: 3799657 • Letter: C

Question

Create a method called GreatestCommonDivisor that used Euclids algorithm as defined in this video https://www.youtube.com/watch?v=fwuj4yzoX1o - do not search out c# versions of the algorithm, everything you need is explained in the video and there should be no need for any additional 'research'.

Your method signature should look like this

int GreatestCommonDivisor(int a, int b)

Create a test program that demonstrates the following

GreatestCommonDivisor(164, 410) = 82

GreatestCommonDivisor(87801, 1469) = 113

Explanation / Answer

Hi, Please find my method.

Please let me know in case of any issue.

int GreatestCommonDivisor(int a, int b){

if (a == 0)
return b;
return GreatestCommonDivisor(b%a, a);
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote