Capgemini Interview Question

coding for the leap year