function x=gaussseidel(A,b,x0,m)
n=size(A,1);
x=x0;
for passo=1:m
    for i=1:n
        c=b(i);
        for j=1:i-1
            c=c-A(i,j)*x(j);
        end
        for j=i+1:n
            c=c-A(i,j)*x(j);
        end
        x(i)=c/A(i,i);
        norm(b-A*x)
    end
end