Generalizing theorems of Nosal and Nikiforov: Triangles and quadrilaterals