Number conversions

 BBS: Inland Empire Archive
Date: 03-20-92 (22:49)             Number: 176
From: STEVE HALKO                  Refer#: 155
  To: KEVIN NEWELL                  Recvd: NO  
Subj: Number conversions             Conf: (2) Quik_Bas
KN>I am looking for a quickie and easy way to convert decimal to base 36 I
KN>have seen some code in the past, but I can not  find it...

  Try this.  The base 36 "digits" are just like hex (0 thru F) except
  they go from 0 thru Z.


  DEFINT A-Z
  INPUT "Enter decimal number: ", Decimal
  PRINT Decimal; " base 10  is ";
  IF Decimal = 0 THEN
     Base36$ = "0"
  ELSE
     DO UNTIL Decimal = 0
          Remainder = Decimal MOD 36
          IF Remainder < 10 THEN
               NewPart$ = LTRIM$(STR$(Remainder))
          ELSE
               NewPart$ = CHR$(55 + Remainder)
          END IF
          Base36$ = NewPart$ + Base36$
          Decimal = Decimal \ 36
     LOOP
  END IF
  PRINT Base36$; " base 36."
  END

 * SLMR 2.1a * This tagline stolen by Silly Little Mail Reader!

--- DB B1062/002487
 * Origin: Gulf Coast BBS -QuickSHARE #2- (904)563-2547 HST/V.32bis (1:365/12)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET