+ 61-7-5641-0117

Our Rating 4.9 out of 5 based on 15243 Votes

# Assignment Question :- Euclid's algorithm for finding the greatest common divisor

### Assignment Question 7

Assignment #14

Recursion can have a very simple solution to many problems.  In this exercise design and implement a program that implements Euclid's algorithm for finding the greatest common divisor (GCD) of two positive integers.  (The GCD is the largest integer that divides both values without producing a remainder.)  Create a class DivisorCalc with a static method gcd(int num1, int num2) and returns the GCD of the two numbers.  As a refresher, here is Euclid's GCD:

1. gcd(num1, num2) is num2 if num2 <= num1 and num2 divides num1
2. gcd(num1, num2) is gcd(num2, num1) if num1 < num2
3. gcd(num1, num2) is gcd(num2, num1%num2) otherwise.

Files:

src/lab14/DivisorCalc.java --  The class that contains a gcd function.

test/lab14/GCDTester.java -- Shall contain testing methods, some of which will be written in class and pushed to GitHub.
{"ft_lang_label":"__label__en","ft_lang_prob":0.8345336,"math_prob":0.96933943,"size":925,"snap":"2021-31-2021-39","text_gpt3_token_len":234,"char_repetition_ratio":0.121606946,"word_repetition_ratio":0.013888889,"special_character_ratio":0.2454054,"punctuation_ratio":0.10982659,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9827309,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-07-26T19:13:11Z\",\"WARC-Record-ID\":\"<urn:uuid:990ea955-293f-48d3-8127-3dcd9c0374ae>\",\"Content-Length\":\"48711\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:126306a5-b88c-428d-83d4-cd4ed073f05a>\",\"WARC-Concurrent-To\":\"<urn:uuid:6332ca6a-ca46-42b1-9d33-1eae765570da>\",\"WARC-IP-Address\":\"160.153.92.200\",\"WARC-Target-URI\":\"https://www.myassignmenthelp.net/java-assignment-help/euclids-algorithm-for-finding-the-greatest-common-divisor\",\"WARC-Payload-Digest\":\"sha1:KWHNYFRD26ZPMQ3UWMBZPZ77QH6KNKC3\",\"WARC-Block-Digest\":\"sha1:R3N2CHRNCX3TQAFNEMGKIOWMWJTHLZNL\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-31/CC-MAIN-2021-31_segments_1627046152144.92_warc_CC-MAIN-20210726183622-20210726213622-00502.warc.gz\"}"}