/* YOUR FILE-HEADER COMMENT HERE */ #include #include /** * Calculates how many days are in the given month, also based upon if * this a leap year or not. * * If the month number is invalid, return 0. * * @param[in] month_num Month number, where 1 is January, 12 is December * @param[in] is_leap_year Non-zero if this is a leap year, only * relevant for February (month number is 2) * @return Days in month */ extern unsigned month_calc(unsigned month_num, unsigned is_leap_year); int main(int argc, char *argv[]) { /* PART 3: YOUR CODE HERE */ if (argc < 3) { fprintf(stderr, "Need a month number and year.\n"); exit(EXIT_FAILURE); } else { int month_num = atoi(argv[1]); int year = atoi(argv[2]); int is_leap_year = ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0); /* UNCOMMENT THE FOLLOWING LINE WHEN STARTING PART 4 printf("Number of days for month %d, year %d is: %u\n", month_num, year, month_calc(month_num, is_leap_year)); */ } return 0; }