+ 1

Leap year

Want a logic

27th Aug 2017, 8:04 AM
kokulan
5 Respuestas
+ 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
27th Aug 2017, 11:43 AM
Dragon Slayer Xavier
Dragon Slayer Xavier - avatar
27th Aug 2017, 8:20 AM
RZK 022
RZK 022 - avatar
+ 1
https://code.sololearn.com/cG8u6Ig38Fmg/?ref=app
27th Aug 2017, 8:53 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
0
if(year %4==0) //Leap year else //not a leap year
27th Aug 2017, 8:20 AM
Suhail Pappu
Suhail Pappu - avatar
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
27th Apr 2021, 10:23 AM
Manthan Santara
Manthan Santara - avatar