Last active
December 11, 2015 19:28
-
-
Save antonyxia/4648220 to your computer and use it in GitHub Desktop.
Bissextile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Scanner; | |
| class Bissextile{ | |
| public static void main(String[] args) { | |
| System.out.print("请输入年份"); | |
| int year; | |
| Scanner scanner = new Scanner(System.in); | |
| year = scanner.nextInt(); | |
| if (year < 0 || year > 9999){ | |
| System.out.println("年份有误,程序退出!"); | |
| System.exit(0); | |
| } | |
| if ((year % 4 == 0)) && (year % 100 != 0) || (year % 400 == 0)) | |
| System.out.println(year+"是闰年"); | |
| else | |
| System.out.println(year+"不是闰年"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment