In this study, the structural and electronic properties of phosphorus and sulfur doped (6,6) and (10,0) single walled boron nitride nanotubes was investigated using density functional theory For all nanotubes, the structural parameters such as stabilization energy, protruding of heteroatom, bond lengths and angles and electronic properties including the energy and schemes of high occupied molecular orbital, HOMO, and low unoccupied molecular orbital, LUMO, the HOMO-LUMO gap, the hybridization of atoms, charge distributions and the density of states are calculated and evaluated, The adsorption of carbon monoxide is also investigated on the extenor surface of S-doped single walled boron nitride nanotubes. The energy of adsorption, gas-nanotube equilibrium distance, charge transfer and the other electronic properties are calculated and discussed.