Skip to content

Commit

Permalink
add pseudocode
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristian Rother committed Feb 12, 2024
1 parent 8d5909c commit 831c327
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions challenges/gcd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ Greatest Common Denominator
Algorithm <https://en.wikipedia.org/wiki/Euclidean_algorithm>`__ **to
determine the greatest common denominator of two integers.**

Pseudocode
----------

1. you have two integer numbers a and b
2. copy the value of b
3. set b to the modulo of a and b
4. set a to the copy of b
5. if b is not zero, go back to step 2.
6. a is the greatest common denominator of a and b

Tests
-----

Expand All @@ -16,11 +26,5 @@ Use the following code to test your function:
assert gcd(12, 8) == 4
assert gcd(42, 12) == 6
Hints:
------

Translate the `pseudocode from the Wikipedia
page <https://en.wikipedia.org/wiki/Euclidean_algorithm#Implementations>`__
into executable code and run it.
*Translated with* `www.DeepL.com <https://www.DeepL.com/Translator>`__

0 comments on commit 831c327

Please sign in to comment.