      PROGRAM CONDITIONLOOP

      IMPLICIT NONE
      
      INTEGER N, FACTOR
      REAL SQRTN
      LOGICAL FOUND
      
      PRINT *, 'INPUT N'
      READ *, N
      DO WHILE (N .LE. 1)
        PRINT *, 'INPUT N'
        READ *, N
      ENDDO  
      
      PRINT *, 'N = ', N
      SQRTN = SQRT(REAL(N))
      PRINT *, 'SQRT OF N IS ', SQRTN
      
      FOUND = .FALSE.
      FACTOR = 2
      
      DO WHILE (.NOT. FOUND .AND. (FACTOR .LE. SQRTN))
        IF (MOD(N, FACTOR) .EQ. 0) THEN
          FOUND = .TRUE.
        ELSE
          FACTOR = FACTOR + 1
        ENDIF  
      ENDDO
      
      PRINT *, 'THE SMALLEST FACTOR OF N IS', FACTOR
      STOP
      END    
      
      
      