We investigate the electron and hole energy states for ellipsoidal and rectangular torus-shaped InAs/GaAs semiconductor quantum rings in an external magnetic field. Our realistic three-dimensional (3D) model construction is based on: (i) the effective mass Hamiltonian in non-parabolic approximation for electrons, (ii) the effective mass Hamiltonian in parabolic approximation for holes, (iii) the position- and energy-dependent quasi-particle effective mass approximation for electrons, (iv) the finite hard wall confinement potential, and (v) the Ben Daniel-Duke boundary conditions. To solve this 3D nonlinear problem, we apply the nonlinear iterative method to obtain self-consistent solutions. Due to the penetration of the applied magnetic field into the torus region, we have found a non-periodical oscillation of the energy band gap versus magnetic fields between the lowest electron and hole states. The oscillation is shape- and size-dependent. The result is useful to describe magneto-optical properties of the nano-scale quantum rings.