You are required to write a C program that accepts two dates in the year 201 and prints out the number of days which are strictly between the two specified dates. Each date will be specified by two integers, with the first integer representing the month and the second representing the day.

Example: The two integers 2 and 10 represent the date February 10, 201 . Likewise, the two integers 3 and 7 represent March 7, 201 . The number of days that lie strictly between these two dates is 2 . (Of these, 1 are in February and the remaining 6 are in March.) As another example, if the first date is specified by the integers 10 and 17 (which represent the date October 17, 201 ) and the second date is specified by the integers 10 and 18 (which represent the date October 18, 201 ), the answer to be printed is 0.

The outline for your program is as follows.

1. Prompt the user for the first date. Read the date and check if it is valid. If it is not v alid, print a suitable error message and stop. (Conditions for the validity of a date are given later in this han dout.)

2. Prompt the user for the second date. Read the date and check if it is valid. If it is not v alid, print a suitable error message and stop.

3. If the second date precedes the first date, print a suitable error message and stop.

4. Compute the number of days which are strictly between the first and the second dates.

5. Print the answer computed in Step 4 and stop

Conditions for a date to be valid: Suppose a date is specified by the t wo integers m (the month) and d (the day). For this date to be valid, both of the following conditions must be satisfied.

(a) The value of m should be at least 1 and at most 12.

(b) The value of d should be at least 1 and at most the maximum number of days possible in the month specified by m .

Additional notes about the program:

(a) For this assignment, your program may consist of just one function, namely main .

(b) Your program should read all its input from stdin; that is, you must use the scanf function for reading the input.

(c) Your program must write all its output to stdout; that is, you must use the printf function for producing prompts, error messages and the final result.

(d) You may assume that for each prompt, the user will t yp e t wo integers separated by one or more spaces.

(e) Other than the validity checks mentioned in Steps 1 through 3 in the program outline ab o ve, no other error checks are needed

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.