判断是否为闰年

package blog;

import java.util.Scanner;

public class year {

	public static void main(String[] args) {
		
		year();
	}

	static void year() {
		Scanner input = new Scanner(System.in);
		int y = input.nextInt();
		if((y % 4 == 0 && y % 100 != 0) || y % 4 == 0) {
			System.out.println(y+"年为闰年");
		}else {
			System.out.println(y+"年不是闰年");
		}
	}
	
}

  

posted @ 2019-11-17 19:21  王思慧  阅读(123)  评论(0)    收藏  举报