Roman Numerals

A program for generating the first 3999 Roman numerals.

      REM roman numerals
      REM Tim Street
      REM 12/11/2011
     
     
      PRINT "Enter an integer, between 1 and 3999 inclusive,"
      PRINT "The program outputs the same number in Roman numerals."
      REPEAT
       
        REM get the user's number
        REPEAT
          ok% = TRUE : REM assume the best case
          PRINT
          INPUT "Enter an integer : " n%
         
          REM check boundaries
          CASE TRUE OF
            WHEN n%<=0
              PRINT "Number entered is too low!"
              ok% = FALSE
             
            WHEN n%> 3999
              PRINT "Number entered is too high!"
              ok% = FALSE
             
          ENDCASE
          REM end of check boundaries
        UNTIL ok%
       
        REM the algorithm
        WHILE n% >= 1000
          PRINT "M";
          n% -= 1000
        ENDWHILE
       
        IF n%>=900 THEN
          PRINT "CM";
          n% -= 900
        ENDIF
       
        WHILE n%>=500
          PRINT "D";
          n% -= 500
        ENDWHILE
       
       
        WHILE n%>=400
          PRINT "CD";
          n% -= 400
        ENDWHILE
       
       
        WHILE n% >= 100
          PRINT "C";
          n% -= 100
        ENDWHILE
       
       
        IF n%>= 90 THEN
          PRINT "XC";
          n% -= 90
        ENDIF
       
       
        WHILE n% >= 50
          PRINT "L";
          n% -= 50
        ENDWHILE
       
       
        WHILE n% >= 40
          PRINT "XL";
          n% -= 40
        ENDWHILE
       
       
        WHILE n% >= 10
          PRINT "X";
          n% -= 10
        ENDWHILE
       
       
        WHILE n% >= 9
          PRINT "IX";
          n% -= 9
        ENDWHILE
       
       
        WHILE n% >= 5
          PRINT "V";
          n% -= 5
        ENDWHILE
       
       
        IF n% = 4 THEN
          PRINT "IV"
          n% = 0
        ENDIF
       
       
        WHILE n% > 0
          PRINT "I";
          n% -= 1
        ENDWHILE
       
      UNTIL FALSE