Count in octal: Difference between revisions
Content added Content deleted
(→LOLCODE: Add implementation) |
|||
Line 998: | Line 998: | ||
<lang runbasic>input "Begin number:";b |
<lang runbasic>input "Begin number:";b |
||
input " End number:";e |
input " End number:";e |
||
for i = b to e |
for i = b to e |
||
print i;" ";toBase$(8,i) |
print i;" ";toBase$(8,i) |
||
next i |
next i |
||
end |
end |
||
function toBase$(base,base10) |
function toBase$(base,base10) |
||
maxIntegerBitSize =len( str$( base10)) |
|||
toBase$ ="" |
|||
for i = 10 to 1 step -1 |
for i = 10 to 1 step -1 |
||
toBase$ |
toBase$ = str$(base10 mod base) +toBase$ |
||
base10 |
base10 = int(base10 / base) |
||
if base10 < 1 then exit for |
if base10 < 1 then exit for |
||
next i |
next i |