Question: Using the program developed in Problem 19, write a program that uses the switch structure to compute the number of days in a year up

Using the program developed in Problem 19, write a program that uses the switch structure to compute the number of days in a year up to a given date, given the year, the month, and the day of the month.


Write a program that accepts a year and determines whether the year is a leap year. Use the mod function. The output should be the variable extra_day, which should be 1 if the year is a leap year and 0 otherwise. The rules for determining leap years in the Gregorian calendar are as follows:

1. All years evenly divisible by 400 are leap years.

2. Years evenly divisible by 100 but not by 400 are not leap years.

3. Years divisible by 4 but not by 100 are leap years.

4. All other years are not leap years.

For example, the years 1800, 1900, 2100, 2300, and 2500 are not leap years, but 2400 is a leap year.

Step by Step Solution

3.39 Rating (165 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

include int main int year extraday 0 printfEnter the year scan... View full answer

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 Introduction Mechanical Engineering Questions!