[Coco] Converting Dec to Binary

Kevin Becker kevin at kevinbecker.org
Wed Mar 21 13:33:34 EDT 2018


Allen's answer is way better than mine.  I didn't even realize you could
AND two decimals together like that in DECB.  I spent most of my time
trying to figure out the modulo command in DECB before I realized there
wasn't one, lol.

10 INPUT "DECIMAL NUMBER:";D
20 D=INT(D)
30 IF D=0 GOTO 80
40 R=D-INT(D/2)*2
50 B$=STR$(R)+B$
60 D=D/2
70 GOTO 20
80 PRINT B$


On Wed, Mar 21, 2018 at 12:54 PM, Allen Huffman <alsplace at pobox.com> wrote:

> >    You forgot one line.
> > 0 REM THIS HOW IT WORKS
>
> 0 REM TRAIL AND ERROR
>
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>


More information about the Coco mailing list