You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
var a = 2154; //First number
|
|
var b = 458; //Second number
|
|
var gcd;
|
|
while (a!=b)
|
|
{
|
|
if (a>b)
|
|
{
|
|
a = a -b;
|
|
}
|
|
else
|
|
{
|
|
b = b - a;
|
|
}
|
|
}
|
|
gcd = a;
|
|
console.log(gcd);
|