mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-07 02:05:08 +08:00
Update DecimalToOctal.js
This commit is contained in:
@ -5,7 +5,7 @@ function decimalToOctal(num) {
|
|||||||
oct=oct+(r*Math.pow(10,c++));
|
oct=oct+(r*Math.pow(10,c++));
|
||||||
num =Math.floor(num/ 8); // basically /= 8 without remainder if any
|
num =Math.floor(num/ 8); // basically /= 8 without remainder if any
|
||||||
}
|
}
|
||||||
console.log("The decimal in binary is " + oct);
|
console.log("The decimal in octal is " + oct);
|
||||||
}
|
}
|
||||||
|
|
||||||
decimalToOctal(2);
|
decimalToOctal(2);
|
||||||
|
Reference in New Issue
Block a user