Which day of the week (Sunday, Monday, etc.) is the probability largest to fall on the 13th of a random month, in a random year?
Or is this probability the same for each day of the week?
(In reply to
re: Solution by Charlie)
Charlie: "Perhaps what went wrong was in using INTEGER rather than LONG. INTEGER can go only up to about 32,000 and then cycles around to something like -32,000, etc, so you're not getting the real year numbers in your comparison for leap year,"
In Visual Basic .NET 2003, the Integer datatype goes up to +2,147,483,647. (The negative max is -2,147,483,648). The real problem was that I was correctly setting two flags to indicate leap years, but then I was not testing those flags to determine leap years later, but just testing for "multiple of 4".
|
Posted by Penny
on 2004-08-14 06:37:58 |