home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1986 February / Ahoy_Magazine_86-02_1986_Double_L.d64 / ternary (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  232b  |  10 lines

  1. 0 rem << cd26-4a >>
  2. 1 rem  commodare #22-4 :
  3. 2 rem         ternary turnabout
  4. 3 rem  solution by david hoffner
  5. 4 rem
  6. 5 b=3 : f=b+1
  7. 10 input"decimal";d
  8. 20 c=int(d/b):e=int(f*(d/b-c)):a$=right$(str$(e),1)+a$:if c then d=c:goto 20
  9. 30 print"base"b": "a$
  10.