function [L, D, U, count] = nopivot(A)
n = size(A);
count = 0;
% compute L
L = zeros(n); D = zeros(n); U = zeros(n);
for i = 1:n
    L(i,i) = 1;
end
count = 0;
for i = 1:n-1
    for j = i+1:n
        L(j,i) = A(j,i)/A(i,i);
        count = count+1;
        for k = i+1:n
            A(j,k) = A(j,k) - L(j,i)*A(i,k);
            count = count+2;
        end
    end
end
for i = 1:n
    D(i,i) = A(i,i);
    U(i,i) = 1;
    for j = i+1:n
        U(i,j) = A(i,j)/D(i,i);
        count = count+1;
    end
end