Home  >  Article  >  Java  >  Detailed explanation of sample code for java leap year judgment

Detailed explanation of sample code for java leap year judgment

黄舟
黄舟Original
2017-03-29 10:55:052992browse

This article mainly introduces the relevant information about leap year judgment in java interview questions. Friends who need it can refer to it

java leap year judgment

Foreword:

Given a year, determine whether this year is a leap year.

When one of the following conditions is met, this year is a leap year:

1. The year is a multiple of 4 instead of 100;

2. The year is 400 multiples.

Other years are not leap years.

Input format

The input contains an integery, representing the current year.

Output format

Output one 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 in this question, you need to strictly follow the case given in the test question, No points will be awarded for incorrect capitalization

Sample input

2013

Sample output

no

Sample input

2016

Sample output

yes

Data scale and convention

1990 <= y <= 2050.

The above is the detailed content of Detailed explanation of sample code for java leap year judgment. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn