Answers for "multiple base conversion"

0

multiple base conversion

//Only for bases 2 through 9 
function mulBase(num, base) {
    var s = new Stack();
    do {
        s.push(num % base);
        num = Math.floor(num /= base);
    } while (num > 0);
    let converted = "";
    while (s.length() > 0) {
        converted += s.pop();
    }
    return converted;
}
Posted by: Guest on February-22-2021

Browse Popular Code Answers by Language