function gcd(a,b)
{
if(a==0)
return
b;
return
gcd(b%a,a);
}
var a = 270, b = 192;
console.log("GCD of " +a+ " and
"+b+" = ", gcd(a,b));
Output:-
GCD of 270 and 192 =
6
function gcd(a,b)
{
if(a==0)
return
b;
return
gcd(b%a,a);
}
var a = 270, b = 192;
console.log("GCD of " +a+ " and
"+b+" = ", gcd(a,b));
Output:-
GCD of 270 and 192 =
6
0 Comments