判断闰年

package asda;
import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext())
        {
            int n=scan.nextInt();
            int judge = 0;
            if(n % 100 == 0)
            {
                if(n % 400 == 0)judge = 1;
            }
            else
            {
                if(n % 4 == 0)judge = 1;
            }
            if(judge == 1)
                System.out.println(n+"是闰年");
            else
                System.out.println(n +"不是闰年");
        }
    }
 
}

 

posted @ 2016-10-13 14:06  默问柳  阅读(153)  评论(0编辑  收藏  举报