Tech Support Guy banner
Status
Not open for further replies.
1 - 15 of 15 Posts

·
Registered
Joined
·
72 Posts
Discussion Starter · #3 ·
Its not as simple as just dividing the year by 4, the actual logic for a leap year is:
year is divisible by 4, but NOT by 100 OR year is divisible by 400.
 

·
Registered
Joined
·
4,168 Posts
Originally posted by Aftab:
Its not as simple as just dividing the year by 4, the actual logic for a leap year is:
year is divisible by 4, but NOT by 100 OR year is divisible by 400.
DUH I don't see where I said anything about 100 or 400. Could you show where I did ?
 

·
Registered
Joined
·
72 Posts
Discussion Starter · #5 ·
DUH I don't see where I said anything about 100 or 400. Could you show where I did ?
You have misunderstood what I said. I was pointing out the actual logic of calculating a leap year, I was not trying to say that you had said anything about dividing by 100 and 400. This is what I was trying to get across: A year is a leap year IF the year is divisible by 4 AND 100, OR is divisible by 400.
 

·
Registered
Joined
·
47,110 Posts
:D ALL THIS GAVE ME A HEAD ACHE:mad:
 

·
Registered
Joined
·
72 Posts
Discussion Starter · #9 ·
why can't it be divisible by 100?
The reason it can't be divisible by 100 is because then we would have a leap year every 100 years (century years) as well as every 4 years. This would result in too many extra days being added, about 3 days every 400 years I think. Hope this makes sense.
 

·
Registered
Joined
·
20 Posts
I suppose no one *really* uses the Internet anymore :(

How about this site:
http://www.codetoad.com/vb_leap_year.asp

Any year divisible by 400 will be divisible by 100 as well as 4. The operative function is If divisible by 4 cannot be divisible by 100 - so 2004 is a Leap Year.
2000 is a special case because it was divisble by all three...

( BTW - we do have leap years *every* 100 years ;)
 

·
Registered
Joined
·
20 Posts
Grrr ... I take that last part back - we are entering aperiod where leaps years at the century mark are occuring less often:

$year = 100;
while(1) {
system("cal 2 $year");
sleep 1;
$year+=100;
}

Prior to 1800 every century was a leap year...

Sorry/Bill
 

·
Registered
Joined
·
72 Posts
Discussion Starter · #15 ·
Sorry if I didn't make that clear:
A year will be a leap year if it is divisible by 4 but not by 100. If a year is divisible by 4 and by 100, it is not a leap year unless it is also divisible by 400.
 
1 - 15 of 15 Posts
Status
Not open for further replies.
Top