subroutine matriz_A (N, A)

	integer :: i, j, N

	real,dimension(N,N) :: A

	do i = 1, N

		do j = 1, N

			if ( mod(i+j,2) == 0 ) then
				
				A(i,j) = 1.0

			else

				A(i,j) = -1.0

			end if

		end do

	end do


end subroutine matriz_A

!====================================================================

subroutine matriz_B	(N, B)

	integer :: i, j, N

	real,dimension(N,N) :: B

	do i = 1, N

		do j = 1, N

			B(i,j) = (i+1.0)**(j-1.0)

		end do

	end do

end subroutine matriz_B

!====================================================================

subroutine zero_funcao (itmax,x,tol)

	integer :: i, itmax
	real    :: func, dfunc, x, tol

	do i = 1, itmax

		func  = x**3 - 7.0*x**2 + 7.0*x + 15.0
		dfunc = 3.0*x**2 - 14.0*x + 7

		x = x - func/dfunc

		if ( abs(func/dfunc) <= tol ) exit

	end do

end subroutine zero_funcao