Question d’entretien chez Cognizant

Provide solution through code for even and odd