- #1
madmike159
Gold Member
- 371
- 0
I am making a program in C to tell the user what day of the week at date will be (eg. 1st Jan 2000 is a Saturday).
I need to account for leap years, the rule for them is below.
All years divisible by 4 are leap years unless the year can be divided by 100. There is, however, an exception to this 100 year rule exception. Any year that can be divided by 400 is a leap year. So while the years 1700, 1800 and 1900 were not leap years because they are divisible by 100, the year 2000, because it is divisible by 400, was a leap year.
I can divide the year 2001 by for and get 500.24, but how can I know that its not a interger?
I need to account for leap years, the rule for them is below.
All years divisible by 4 are leap years unless the year can be divided by 100. There is, however, an exception to this 100 year rule exception. Any year that can be divided by 400 is a leap year. So while the years 1700, 1800 and 1900 were not leap years because they are divisible by 100, the year 2000, because it is divisible by 400, was a leap year.
I can divide the year 2001 by for and get 500.24, but how can I know that its not a interger?