Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,37 @@
function to_base(integer i, integer base)
integer c
sequence s = ""
while i>0 do
c = remainder(i,base)
if c<10 then
c += '0'
else
c += 'a'-10
end if
s = prepend(s,c)
i = floor(i/base)
end while
if length(s) = 0 then
s = "0"
end if
return s
end function
function from_base(string s, integer base)
integer res = 0, c
for i=1 to length(s) do
c = s[i]
if c>='0' and c<='9' then
c -= '0'
else
c -= 'a'-10
end if
res = res*base+c
end for
return res
end function
?to_base(256,16)
?from_base("100",16)