Question: I need to code a program in C and it is asking the following information: Day of the year. Your program should take a month,

I need to code a program in C and it is asking the following information:

Day of the year. Your program should take a month, day, and year, and output the number of that day in that year. Eg. February 21 of 2020 is Day 52.

The program should count days, taking into account leap years. A year is a leap year if it is divisible by four, except that any year divisible by 100 is a leap year only if it divisible by 400.

The program must print error messages for days or months out of bounds (taking into account the month, and if relevant, leap years). Program may end on error input, or prompt for correct input in a loop - your call.

Use modular design of your program with functions. Consider defining a function to determine leap year, a function to return number of days in a month, and a separate function to handle user input (values passed to the caller by reference). You should create at least two functions in your program.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!