PROGRAM prime
  IMPLICIT NONE

  INTEGER :: N, i
  LOGICAL :: isprime

  PRINT *, "Dwse thetiko akeraio arithmo"
  READ *, N
  
  isprime = .TRUE.  ! kathe akeraios einai prwtos, .....
  DO i=2,N-1
     IF (MOD(N,i) == 0) THEN
        isprime = .FALSE.
     ENDIF
  ENDDO
     
  IF (isprime) THEN 
     PRINT *, "O arithmos einai prwtos"
  ELSE
     PRINT *, "O arithmos den einai prwtos"
  END IF

END PROGRAM prime
