global basCvt$ basCvt$ ="0123456789abcdefghijklmnopqrstuvwxyz" html "" for i =1 to 10 RandNum = int(100 * rnd(1)) base = 2 +int(35 * rnd(1)) html "" next i html "
DecimalTo BaseNumto Dec
";using("###", RandNum);"";using("###", base);"";toBase$(base,RandNum);"";toDecimal( base, toBase$( base, RandNum));"
" end function toBase$(b,n) ' b=base n=nmber toBase$ ="" for i =10 to 1 step -1 toBase$ =mid$(basCvt$,n mod b +1,1) +toBase$ n =int( n /b) if n <1 then exit for next i end function function toDecimal( b, s$) ' scring number to decimal toDecimal =0 for i =1 to len( s$) toDecimal = toDecimal * b + instr(basCvt$,mid$(s$,i,1),1) -1 next i end function