Functional equations for zeta functions of groups and rings