CJCoding With Joseph
15per day

Greatest Common Divisor

Complete the static method Gcd so it returns the greatest common divisor of a and b using the Euclidean algorithm (repeatedly replace (a, b) with (b, a % b) until b is 0). Do NOT write a Main method.

For Gcd(12, 18) the program prints 6.

Expected Output:

6
Topics:
Methods
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.