#include int main() { int year, n, month, day, t; // calculates day and month from year and // day-within-year // t is an offset to account for leap years. // Note that the first criteria is division by 4 // but that centuries are only // leap years if divisible by 400 // not 100 (4 * 25) alone. printf(" year, followed by day within year\n"); scanf("%d %d", &year, &n); // checking for leap years if ((year/4)*4==year) { t = 1; if ((year/400)*400==year) { t = 1; } else if ((year/100)*100==year) { t = 0; } } else { t = 0; } // accounting for February if (n>(59+t)) { day = n + 2 - t; } else { day = n; } month = (day+91)*100/3055; day = (day+91) - (month*3055)/100; month = month - 2; printf(" calendar date is %d %d %d\n", day, month, year); return(0); }