Skip to content

Commit 831c327

Browse files
author
Kristian Rother
committed
add pseudocode
1 parent 8d5909c commit 831c327

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

challenges/gcd.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ Greatest Common Denominator
55
Algorithm <https://en.wikipedia.org/wiki/Euclidean_algorithm>`__ **to
66
determine the greatest common denominator of two integers.**
77

8+
Pseudocode
9+
----------
10+
11+
1. you have two integer numbers a and b
12+
2. copy the value of b
13+
3. set b to the modulo of a and b
14+
4. set a to the copy of b
15+
5. if b is not zero, go back to step 2.
16+
6. a is the greatest common denominator of a and b
17+
818
Tests
919
-----
1020

@@ -16,11 +26,5 @@ Use the following code to test your function:
1626
assert gcd(12, 8) == 4
1727
assert gcd(42, 12) == 6
1828
19-
Hints:
20-
------
21-
22-
Translate the `pseudocode from the Wikipedia
23-
page <https://en.wikipedia.org/wiki/Euclidean_algorithm#Implementations>`__
24-
into executable code and run it.
2529
2630
*Translated with* `www.DeepL.com <https://www.DeepL.com/Translator>`__

0 commit comments

Comments
 (0)