Prime Composite Testing Program Using User Defined Function

DECLARE FUCTION ISPRIME(N)
CLS
INPUT "Testing Number: ";N
IF ISPRIME(N)=1 THEN
    PRINT N; " IS PRIME NUMBER"
ELSE
   PRINT N;" IS COMPOSITE NUMBER"
ENDIF

FUNCTION ISPRIME(N)
'F if flag which is set to 1 means it is assumed to be prime at first
F=1
'if there is any factor from 2 to half of the number n then the number is composite
FOR I= 2 TO N/2
    IF N MOD I=0 THEN
        F=0
        EXIT FOR
     ENDIF
NEXT I
ISPRIME=F
END FUNCTION

Prime Composite Testing Program

CLS
INPUT "Test Number: ";N
'f is flag which is set to 0 indicating testing number is prime and 1 indicating testing number is composite
F=0
FOR I=2 TO N/2
     IF N MOD I=0 THEN
         F=1
         EXIT FOR
     ENDIF
NEXT I
IF F=0 THEN
   PRINT N;" IS PRIME NUMBER"
ELSE
   PRINT N;" IS COMPOSITE NUMBER"
ENDIF