Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In the modem Gregorian calendar (first adopted in 1582), an extra day (February 29) is added to the calendar to keep calendar years synchronized
In the modem Gregorian calendar (first adopted in 1582), an extra day (February 29) is added to the calendar to keep calendar years synchronized with astronomical years. Leap years occur according to the following rules: 1. Every year that is exactly divisible by four is a leap year, except for years that are exactly divisible by 100 (centurial years), which have additional rules. 2. Centurial years are leap years only if they are exactly divisible by 400. For example, the centurial years 1800 and 1900 are not leap years, but the centurial years 1600 and 2000 are. Write a program that asks the user to input a year and determine if input is a leap year. You can assume that the user will always enter an integer value. If the year is before 1582, the program should print a statement that says it precedes the adoption of the Gregorian calendar. If the year is 1582 or later, the program will print a statement saying whether it was or will be a leap year. Formatting guidelines: the first argument of the print statement should be a tab escape character. Below are some sample runnings of the program. Example 1 Enter year: 1851 1851 is NOT a leap year. Example 2 Enter year: 1600 1600 is a leap year. Example 3 Enter year: 1581 1581 is before the adoption of the Gregorian calendar. Example 4 Enter year: 2020 2020 is a leap year. Example 5 Enter year: 2022 2022 is NOT a leap year.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started