Monte-Carlo simulation of pure U(N) and SU(N) lattice gauge theories with fundamental and adjoint couplings