Leap Year with the Conditional Operator
EasyRead a year and print one line of the form 2024 is a leap year or 1900 is not a leap year. A year is a leap year when it is divisible by 4 but not by 100, or when it is divisible by 400. Store the rule as an int holding 1 or 0, then choose the wording with the conditional operator ?: rather than with if. If the year cannot be read, print invalid input and return 1.
Success Criteria
Your code must pass 5 test case(s) to complete this exercise. 3 hint(s) are available if you need help.
Sign in to track your progress
You can work on exercises as a guest, but sign in to track your progress and save your submissions.
How did you find this exercise?
Your rating helps us improve the content.