Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions