#include <stdio.h>

#define ORIGINYEAR 2007

int year = ORIGINYEAR; /* = 1980 */

int  days = 365;

int IsLeapYear(int year)
{
  return ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0);
}

void zunecode(void)
{
while (days > 365)
{
    printf("looping through while\n");
    if (IsLeapYear(year))
    {
        if (days > 366)
        {
            printf("testing days > 366\n");
            days -= 366;
            year += 1;
        }
    }
    else
    {
        printf("fell through to the else\n");
        days -= 365;
        year += 1;
    }
}
}
 
int main(void)
{
 for(days=0;year<2010;days++)
 {
     zunecode();
     printf("\ndays %d year %d",days,year);
 }
 
 return 0;
}
