Given array of integers ((List of years), and we have to all Leap Years.
To find leap years from an array (list of years), we will traverse array and access each element of array and then check the given conditions, if elements satisfies the given conditions then the number (array element) will be leap year.
The conditions for leap years are:
- If given year is divisible by 4 and not divisible by 100 then it will be leap year.
- If given year is divisible by 4 and divisible by 100 but not divisible by 400 then it will not be a leap year.
- If given year is divisible by 4 and divisible by 100 and also divisible by 400 then it will be a leap year.
For example we have list of integers:
1600 1604 1605 1900 2000
1600 is a leap year
1604 is a leap year
1605 is not a leap year
1900 is not a leap year
2000 is a leap year
Consider the example:
Output