Conversions algorithms : remove live code & console.log.

This commit is contained in:
Eric Lavault
2021-10-09 18:15:30 +02:00
parent ab7e51909a
commit 30779682b9
9 changed files with 73 additions and 31 deletions

View File

@ -6,11 +6,22 @@ function decimalToOctal (num) {
oct = oct + (r * Math.pow(10, c++))
num = Math.floor(num / 8) // basically /= 8 without remainder if any
}
console.log('The decimal in octal is ' + oct)
return oct
}
decimalToOctal(2)
decimalToOctal(8)
decimalToOctal(65)
decimalToOctal(216)
decimalToOctal(512)
export { decimalToOctal }
// > decimalToOctal(2)
// 2
// > decimalToOctal(8)
// 10
// > decimalToOctal(65)
// 101
// > decimalToOctal(216)
// 330
// > decimalToOctal(512)
// 1000