This article has been copy pasted from yahoo answers:

Whether a year will be a leap year or not, is not just an answer but has a lot more story to tell

As the earth travels in its orbit completely around the sun once each year it is also revolving approximately 365 times. But, as we reach that spot in the universe where the clock strikes mid-night on December 31, we are not quite as far along in the orbit as we should be.Scientists have discovered that every four years or so we actually end up being about one day short of where we should be on our orbital path. Naturally, the best solution to get us caught up is to add an extra day to every fourth year. That's exactly what we do, and we add it to our shortest month, February. The years in which we add the extra day are known as Leap years. Normally February has 28 days, but on a leap year February has 29 days.If you wish to calculate when a leap year will occur you are fairly sure to get it right if the year is divisible by four. (1904, 1908, etc.)There's only one problem with this: We still don't end up exactly at the same spot in our orbit around the sun after a while because this method over-compensates for the error. To correct for this problem scientists have calculated that we need to "skip" a leap year every once-in-a-while. Every once-in-a-while is about every 100 years. So, at the turn of the century we normally skip a leap year to compensate. But, that tends to over-compensate, so, once every 400 years we DO NOT skip a leap year.If a centenial year is not divisible by four, there will be NO leap year that year. For instance, 1200 was a leap year, 1600 was a leap year, 1900 was NOT a leap year . . .The 400-year correction turns out to be another over-correction by just a few seconds. Therefore, whenever a millenium begins with an odd number (1000, 3000) scientists leave out an extra day and DO NOT make it a leap year.But don't worry about it, as neither you nor I will be around in a century, or 400 years, much less the year 3,000 !

__Conclusion:__
Rule 1 : Every year which is divisble by 4 and not by 100 is leap year.

Rule 2 : Everyyear which is divisble by 100 and by 400 is a leap year in other words years divisible by 100 would be leap years only if they were divisible by 400 as well.

and hence year 1700 ,1800 ,1900 were not leap years so will be with 3000, but year 2000 is leap year.

and hence year 1700 ,1800 ,1900 were not leap years so will be with 3000, but year 2000 is leap year.

Happy leaping !!

p.s: now this a tr8 to all those young programmers who are writing the leap year program and are confused with why the algorithm is so. :)