Why Leap year are divisible by 4 is not sufficient condition | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why Leap year are divisible by 4 is not sufficient condition

22nd Dec 2016, 2:50 PM
auhan
auhan - avatar
4 Answers
+ 1
if(leap%4==0) //leap year else //not leap year
22nd Dec 2016, 3:12 PM
Suhail Pappu
Suhail Pappu - avatar
+ 1
because earth rotates 366.25041 days a year
22nd Dec 2016, 6:45 PM
Kibrom
Kibrom - avatar
0
Years 1700, 1800, 1900, 2100, 2200, 2300, 2500, 2600 are not leap years even thought they are divisible by four. So if only "year%4==0" is given as condition the above mentioned year will be shown as leap years. So we have to check if they are divisible by 400. Years ending with 00 are leap years only if it is divisible by 400 Please Upvote :)
22nd Dec 2016, 3:27 PM
Shiva Shankar
Shiva Shankar - avatar
0
for century it must devided by 400 and other than century devided by 4.
22nd Dec 2016, 6:51 PM
himanshu yadav
himanshu yadav - avatar