Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Binary to Integers / Integers to Binary
--Zeehkers function int2bin(a) local b = a local c = "" while b > 0 do b = b / 2 if b > math.floor(b) and b < math.floor(b) + 1 then c = c.."1" else c = c.."0" end b = math.floor(b) end print(string.reverse(c)) end function bin2int(a) local b = 0 for c = 1, #tostring(a), 1 do b = b + math.floor((string.sub(a, c, c)) * 2 ^ ((#tostring(a) - c))) end print(tostring(b)) end int2bin(100) bin2int(1100100)
run
|
edit
|
history
|
help
0
MXR
Creating habits v3, Lua
ok
ok
VWPASSATPOLIZEI
hack
zzz
ok
Lua recursion with function
PAID HACK PuBG