REM This program lists the divisors of a positive integer N
REM It also finds the first integer that is not a divisor of N
DEFLNG K, N
DEFSNG H

Begin:
CLS
REM Prompt for integer.
INPUT "What is the positive integer"; N
PRINT
PRINT "The divisors of"; N; "are:"
PRINT

REM Find and print the divisors.
K = 1
HALF = N / 2
DO WHILE K <= HALF
        IF N MOD K = 0 THEN PRINT K; ",";
        K = K + 1
LOOP
PRINT N

REM Find first integer not dividing N
K = 1
DO
        K = K + 1
        IF N MOD K <> 0 THEN EXIT DO
LOOP UNTIL K = N + 1
PRINT
PRINT "The first integer not dividing "; N; "is "; K

REM Prompt for repeat
PRINT
INPUT "Do you want to run the program again (enter y or n)"; ans$
IF ans$ = "y" OR ans$ = "Y" THEN GOTO Begin
PRINT
PRINT "OK - up to you!"
END