Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including gcd with all npm packages installed. Try it out:

var gcd = require("gcd")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

gcd v0.0.1

compute the greatest common divisor using euclid's algorithm

gcd

Compute the greatest common divisor using Euclid's algorithm.

testling badge

build status

example

var gcd = require('gcd');
var n = gcd(121,44);
console.log(n);

11

methods

var gcd = require('gcd')

gcd(a, b)

Return the greatest common divisor of the integers a and b using Euclid's algorithm.

install

With npm do:

npm install gcd

license

MIT

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free