home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
me34src.zip
/
me3
/
mutt
/
builtin
/
tobase.mut
< prev
next >
Wrap
Text File
|
1995-01-14
|
459b
|
18 lines
;; tobase(n,base): convert n (base 10) to base. eg (tobase 10 16) => A
;; C Durland Public Domain
(include mod.mut)
(defun
tobase (int n base) HIDDEN
{
(if (< n base) (extract-elements "0123456789ABCDEF" n 1)
(concat
(tobase (/ n base) base) ; tobase n/base base
(tobase (mod n base) base) ; tobase (n mod base) base
)
)
}
)
;(msg (tobase (convert-to NUMBER (ask "n = "))
; (convert-to NUMBER (ask "base = "))))