I’m really sorry for that i don’t mean it but i was writing just 3 back ticks after i close with 3 others according to this link Markdown Code Formatting i need to press [shift +enter] i’ m not doing it for a purpose please if it s not the right way correct me again here s my code
function gcd(arr) {
var a=arr[0];
var b=arr[1]
do {
if (a > b) {
a = a % b;
}
if (a < b) {
b = b % a;
}
} while ((a > 0) && (b > 0))
if (a > b) return a
if (b > a) return b
}
console.log(gcd([1, 5]))
function lcm(arr) {
let x=arr[0]
let y=arr[1]
let lcd = Math.abs(x * y) / gcd(arr);
console.log(lcd);
return lcd
}
function smallestCommon(arr)
{let i=arr[0]
let j=arr[1]
for (i;i<=j;i++)
{
if(lcm(arr) % i ==0)
return lcm(arr)
else
{
/*problem here how to come back to a greater
common multiple if not evenly divisible
by all numbers in the range of the array*/
}
}
}
console.log(lcm([1, 5]))
console.log(smallestCommon([1,5]))
i wish it s formatted now