Why we take year %100 != 0 to find leap year ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why we take year %100 != 0 to find leap year ??

12th Dec 2016, 10:49 AM
Nishant singh
Nishant singh - avatar
4 Answers
+ 3
Hi Nishant, I have a code named "Leap Year Test" in my profile which might help answer your question. Let me know what you think about it.
12th Dec 2016, 5:00 PM
Dhaval Furia
Dhaval Furia - avatar
+ 3
Leap years are according to two rules. (a) When the last two digits are 00:- If the last two digits are 00, then the year is leap year if the year is divisible by 400. For example:- The year 2000 is leap year but 2100 is not a leap year. (b) When the last two digits are not 00:- If the last two digits are not 00, then the year is leap year if the year is divisible by 4. For example:- The year 2012 is leap year but 2014 is not a leap year.
28th Dec 2016, 6:19 PM
Sarthak Mathur
Sarthak Mathur - avatar
+ 2
First, we check that if the year is divisible by 100 and then by 400, it is a leap year.
29th Dec 2016, 2:18 PM
Siddharth Bose
Siddharth Bose - avatar
+ 1
leap year is the year that can divided by 4 or 400 only this means after every four year will came leap year thanks.
6th Jan 2017, 6:17 PM
Mohamed Omar Abdi
Mohamed Omar Abdi - avatar