Question: Write a program that reads an integer value from the user representing a year. The purpose of the program is to determine if the year

Write a program that reads an integer value from the user representing a year. The purpose of the program is to determine if the year is a leap year (and therefore has 29 days in February) in the Gregorian calendar. A year is a leap year if it is divisible by 4, unless it is also divisible by 100 but not b 400. For example, the year 2003 is not a leap year, but 2004 is. The year 1900 is not a leap year because it is divisible by 100 but not by 400, whereas the year 2000 is a leap year because even though it is divisible by 100, it is also divisible by 400. Produce an error for any input value less than 1582 (the year the Gregorian calendar was adopted). Additional background Although there are exceptions, a leap year occurs once every four years in order to keep the calendar year properly synchronized with the astronomical or seasonal year. The necessity for leap years arises from the fact that a year on Earth is actually about 365 and 1/4 days long. A leap year has a total of 366 days, instead of the usual 365 as a result of adding an extra day (February 29) to the Gregorian calendar. The Gregorian calendar is the calendar format currently used by most modern societies. The Gregorian calendar was introduced in 1582, to replace the flawed Old Style Julian calendar, though the adoption of this new calendar was not universally concurrent, with many nations delaying its implementation several centuries. Leap year guidelines A year is a leap year if it is divisible by 4, but not divisible by 100. For example, 1992 and 2008 are divisible by 4, but not by 100. A year that is divisible by 100 is a leap year if it is also divisible by 400. For example, 1600 and 2000 are divisible by 400. However, 1800 is not a leap year because 1800 is not divisible by 400. As you may notice, any year evenly divisible by 4 is a leap year, except centesimal years (years ending in two zeros) which are considered common years and thus have the typical 365 days, unless they are also evenly divisible by 400. Therefore, 1600 and 2000 are leap years, while 1700, 1800, 1900 and 2100 are not

In C++ please. Thank You

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!