function [x] = hw9afn(A,b,n,N)

   for i = 1:n
      xold(i,1) = 0;
   end

   for k = 1:N
      for i = 1:n
         x(i,1) = b(i,1);
         for j = 1:n
            if j ~= i
               x(i,1) = x(i,1)-A(i,j)*xold(j,1);
            end
         end
         x(i,1) = x(i,1)/A(i,i);
      end

      for i = 1:n
         xold(i,1) = x(i,1);
      end
   end
        

end
