binary = function(n)
    result = ""
    while n
        result = str(n%2) + result
        n = floor(n/2)
    end while
    if result == "" then return "0"
    return result
end function
print binary(5)
print binary(50)
print binary(9000)
            Run some MiniScript code right in your browser!