Spectroscopy of hydrogenlike and heliumlike argon