We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3e47ca6 commit 97ac1c3Copy full SHA for 97ac1c3
Conversions/DecimalToHex.js
@@ -9,11 +9,16 @@ function intToHex(num){
9
}
10
return num;
11
12
+
13
function decimalToHex(num){
14
let hex_out = [];
15
while(num > 15) {
16
hex_out.push(intToHex(num%16));
17
num = Math.floor(num / 16);
18
- return hex_out.join("");
19
+ return intToHex(num) + return hex_out.join("");
20
21
22
+// test cases
23
+console.log(decimalToHex(999098) === "F3EBA");
24
+console.log(decimalToHex(123) === "7B");
0 commit comments