Skip to content

Instantly share code, notes, and snippets.

@geta6
Created October 23, 2012 03:00
Show Gist options
  • Save geta6/3936405 to your computer and use it in GitHub Desktop.
Save geta6/3936405 to your computer and use it in GitHub Desktop.
greatest common divisor x and y
[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