Skip to content

Instantly share code, notes, and snippets.

@antonyxia
Last active December 11, 2015 19:28
Show Gist options
  • Save antonyxia/4648220 to your computer and use it in GitHub Desktop.
Save antonyxia/4648220 to your computer and use it in GitHub Desktop.
Bissextile
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