PROGRAM digsq
  IMPLICIT NONE

  INTEGER :: i, k

  i = 0
  DO
     k = i*i / 100
     k = MOD(k,10)
     IF (k == 3) EXIT
     i = i + 1
  END DO

  PRINT *, i
END PROGRAM digsq
