In [1]:
function dec_to_bin(dec)
ret = 0
pow = 1
while dec > 0
val = dec % 2
dec = Int(trunc(dec / 2))
ret += val*pow
pow *= 10
end
return ret
end
Out[1]:
In [2]:
println(dec_to_bin(41))
In [ ]: