      Program nr
      implicit none
      integer i, n
      real*8 x, tol, x0
      real*8 f, fp
      n=1000
      x = 0.0d0
      do i=1,n
        write(*,*) x
        x = x - f(x)/(fp(x)+1e-7)
      end do
      write(*,*) x
      End program nr

      Function f(x)
      real*8 f,x
      f=x**2 - 10
      end function

      Function fp(x)
      real*8 fp,x
      fp=2*x
      end function
