PROGRAM prime
  IMPLICIT NONE

  INTEGER :: N, i, k

  PRINT *, "Dwse thetiko akeraio arithmo"
  READ *, N

  k = 0   ! tha metrisoyme posoi akeraioi diairoun to N
  DO i=2,N-1
     IF (MOD(N,i) == 0) THEN
        k=k+1 ! brhkame diaireti, ayksanoyme ton metriti
     ENDIF
  ENDDO
     
  IF (k==0) THEN 
     PRINT *, "O arithmos einai prwtos"
  ELSE
     PRINT *, "O arithmos den einai prwtos"
  END IF

END PROGRAM prime
