+ 1

# Leap year

Want a logic

5 Answers

+ 4

Divide by 4, if Remainder is zero, it's leap year.
First divide by 100, if Remainder is zero, then divide by 400, again remainder zero means leap year...
For numbers not dividing exactly by 100, see 1st line...
And here's the code.
https://code.sololearn.com/cyl9chLy2vDz/?ref=app

+ 2

This may help you .
https://code.sololearn.com/cJwVIsTCer72/?ref=app

+ 1

https://code.sololearn.com/cG8u6Ig38Fmg/?ref=app

0

if(year %4==0)
//Leap year
else
//not a leap year

0

A year that is evenly divisible by 100 (for example, 1900) is a leap year only if it is also evenly divisible by 400.
For this reason, the following years are not leap years:
1700, 1800, 1900, 2100, 2200, 2300, 2500, 2600
This is because they are evenly divisible by 100 but not by 400.
The following years are leap years: 1600, 2000, 2400
This is because they are evenly divisible by both 100 and 400.
https://code.sololearn.com/ck3tP7Aq1J20