function C  = mult( A,B )
%mult function : multiplies two matrices

    % note: there is no output to the screen,
    % we have ; at the end of all commabds

    [aRows,aCols] = size(A);
    [bRows,bCols] = size(B);
    C=zeros(aRows,bCols);

    if ( aCols ~= bRows )
        error('matrix sizes not consistent with multiplication')
    end

    % we consider the i,j element of the new matrix C
    % this requires two loops, one over i and the other over j
    for i=1:aRows
        for j=1:bCols
            % for each element of C we have to do a sum with n terms
            for k=1:aCols
                C(i,j) = C(i,j) + A(i,k) * B(k,j);
            end
        end
    end

    % the output of the function will be C
    % (this is determined by the first line of the function)

end

