UNPKG

publish_test_sakshi_kottawar

Version:

the call will result the GCD fo two numbers which are passed as parameters in call var gcd=require("publish_test_sakshi_kottawar/gcd"); var ans=gcd.GCD(5,6);

13 lines 257 B
module.exports.GCD = function(x, y) { if ((typeof x !== 'number') || (typeof y !== 'number')) return false; x = Math.abs(x); y = Math.abs(y); while(y) { var t = y; y = x % y; x = t; } return x; }