Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int IsLeapYear(int year) {
- if(year % 400 == 0){
- return 1;
- } else if(year % 100 == 0){
- return 0;
- } else if(year % 4 == 0){
- return 1;
- } else{
- return 0;
- }
- }
- int main(void)
- {
- int year = 2008;
- int days = 366;
- while (days > 365) {
- if (IsLeapYear(year)) {
- if (days > 366) {
- days -= 366;
- year += 1;
- }
- else {
- days -= 365;
- year += 1;
- }
- }
- }
- printf("end\n");
- }
Add Comment
Please, Sign In to add comment