function gcd(a,b){ let hcf; for (let i = 1; i <= a && i <= b; i++) { // check if is factor of both integers if( a % i == 0 && b % i == 0) { hcf = i; } } return hcf; } gcd(6, 15);
function gcd(a,b){ let hcf; for (let i = 1; i <= a && i <= b; i++) { // check if is factor of both integers if( a % i == 0 && b % i == 0) { hcf = i; } } return hcf; } gcd(6, 15);