判断是不是闰年

 1 import java.util.Scanner;
 2 public class 闰年问题 {
 3 
 4     public static void main(String[] args) {
 5         // TODO Auto-generated method stub
 6 
 7         Scanner scanner=new Scanner(System.in);
 8         long year=scanner.nextInt();
 9         if(((year%4==0)&&(year%100!=0))||(year%400==0)) {
10             System.out.print('Y');
11         }else {
12             System.out.print('N');
13         }
14     }
15 
16 }

 

posted @ 2018-09-30 08:35  kongchung  阅读(115)  评论(0编辑  收藏  举报