16 lines
242 B
JavaScript
16 lines
242 B
JavaScript
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);
|