Created
October 23, 2012 03:00
-
-
Save geta6/3936405 to your computer and use it in GitHub Desktop.
greatest common divisor x and y
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[x, y] = process.argv.slice 2, 4 | |
unless x and y | |
console.log 'Usage [cmd] [x] [y]' | |
console.log 'return greatest common divisor x and y' | |
process.exit 1 | |
while 0 isnt r = x%y | |
x = y; y = r | |
console.log y |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment