Computation of the ground-state energies of H2 and H2O is concerned. Based on the density functional theory (DFT) the ground state energy of a many-electron system can be expressed by electronic density and is the minimum value of a density functional. So the computation can be done by finding a minimum value of a total energy density functional. Firstly, we use linear combination of atomic orbitals (LCAO) to construct the molecular orbital and calculate each term of the density functional, for example, kinetic energy, electron-electron Coulomb energy, electron-core Coulomb energy, and exchange-correlation energy. Next, we take an initial guess and minimize the total density energy functional by using Largrange multipliers method. Finally by steepest descent method, the ground state total energy is obtained. In some special care is needed for the computation of Coulomb potential to avoid the singular points.