Develop a C program to check whether a given year is leap year or not.
Added by Joseph S.
Step 1
- A year is a leap year if it is divisible by 4. - However, if the year is divisible by 100, it is not a leap year unless it is also divisible by 400. Show more…
Show all steps
Close
Your feedback will help us improve your experience
Shelayah Robinson and 69 other Calculus 1 / AB educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
As you surely know, due to some astronomical reasons, years may be leap or common. The former are 366 days long, while the latter are 365 days long. Since the introduction of the Gregorian calendar (in 1582), the following rule is used to determine the kind of year: if the year number isn't divisible by four, it's a common year; otherwise, if the year number isn't divisible by 100, it's a leap year; otherwise, if the year number isn't divisible by 400, it's a common year; otherwise, it's a leap year. The code only reads a year number and needs to be completed with the instructions implementing the test we've just described. The code should output one of two possible messages, which are "Leap year" or "Common year," depending on the value entered. It would be good to verify if the entered year falls into the Gregorian era and output a warning otherwise: "Not within the Gregorian calendar period." Tip: use the != and % operators.
Shelayah R.
Design an algorithm for determining whether a particular year is a leap year. For example, the year 2000 was a leap year.
A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To account for the difference in time, every 4 years, a leap year takes place. A leap year is when a year has 366 days: An extra day, February 29th. The requirements for a given year to be a leap year are: 1) The year must be divisible by 4 2) If the year is a century year (1700, 1800, etc.), the year must be evenly divisible by 400 Some example leap years are 1600, 1712, and 2016. Write a program that takes in a year and determines whether that year is a leap year. Ex: If the input is: 1712 the output is: 1712 is a leap year. Ex: If the input is: 1913 the output is: 1913 is not a leap year. Your program must define and call the following function. The function should return true if the input year is a leap year and false otherwise. bool IsLeapYear(int userYear)
Recommended Textbooks
Calculus: Early Transcendentals
Thomas Calculus
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD