Answers for "how to find hcf of 2 numbers in javascript"

0

how to find hcf of 2 numbers in javascript

var a = userInput[0].split(" ").map(Number)
while(a[0] != a[1])
{
    if(a[0] > a[1]) { 
        a[0] = a[0] - a[1];
    }
    else {
        a[1] =a[1] - a[0]; 
    }
}
console.log(a[0])
Posted by: Guest on May-02-2021

Code answers related to "how to find hcf of 2 numbers in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language