Advertisement
a3f

Step-by-step Numerical System Conversion

a3f
May 14th, 2012
2,751
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 10 i = 1
  2. input "Enter ElAsas (2 for binary,8 for ocatal,16 for hexadecimal)";asas
  3. input "Enter Number: ";x
  4. rem log 2 (x)
  5. dimension = int(log(x)/log(asas))+3
  6. dim num(dimension)
  7. while x > 1
  8.     num(i) = x mod asas
  9.     x = int(x/asas)
  10.     print x
  11.     i = i + 1
  12. WEND
  13.     num(i) = x
  14. print
  15. for m = dimension to 1 step -1
  16.     if num(m) > 9 then
  17.         print chr$(65+num(m)-10);
  18.     else
  19.         print num(m);
  20.     end if
  21. next m
  22.     print
  23.     print
  24.     print "---"
  25. goto 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement