Convert to Roman Numeral

This little program will convert numbers to Roman Numerals. It is able to convert any value from 1 to 3999. Romans did not have a consistent numbering scheme after 3999.

DIM i(13)
DIM r$(13)
KEY$ = "1000 M 900 CM 500 D 400 CD 100 C 90 XC 50 L 40 XL 10 X 9 IX 5 V 4 IV 1 I"
[again]
roman$ = ""
INPUT "Please enter a number:";num
IF num < 4000 THEN
  FOR x = 0 TO 12
    i(x+1) = VAL(word$(KEY$,(x*2)+1))
    r$(x+1) = word$(KEY$,(x*2)+2)
    WHILE num >= i(x+1)
      roman$ = roman$ + r$(x+1)
      num = num - i(x+1)
    WEND
  NEXT x
  PRINT "The ROMAN conversion is: ";roman$
ELSE
  PRINT "The number to be converted is over 3999 - try again."
END IF
confirm "Convert another?";a$
IF a$ = "yes" THEN GOTO [again]

- bradmoore bradmoore Jan 24, 2006