Ad Code

Responsive Advertisement

Ticker

6/recent/ticker-posts

to find GCD using Euclidian algorithm

 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

Post a Comment

0 Comments

Ad Code

Responsive Advertisement