Detailed explanation and examples of leap year judgment of Java interview questions
Java leap year judgment
preface:
Given a year, judge whether it is a leap year.
This year is a leap year when one of the following conditions is met:
1. The year is a multiple of 4 rather than a multiple of 100;
2. The year is a multiple of 400.
Other years are not leap years.
Input format
The input contains an integer y representing the current year.
Output format
Output a line. If the given year is a leap year, output yes, otherwise output No.
Note: when the test question specifies that you output a string as the result (such as yes or no of this question), you need to strictly follow the case given in the test question. If you write the wrong case, you will not get a score.
sample input
two thousand and thirteen
sample output
no
sample input
two thousand and sixteen
sample output
yes
Data scale and agreement
1990 <= y <= 2050。
Thank you for reading, hope to help you, thank you for your support to this site!