전.java

연도를 읽어 윤년인지를 판별하는 프로그램

jeonnew 2021. 1. 31. 15:16
728x90
import java.io.*;

public class chp3_10_8 {
	public static void main(String[] args) throws java.io.IOException{
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		double year;
		
		year = Double.parseDouble(input.readLine());

		if((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
			System.out.println("윤년입니다.");
		else
			System.out.println("윤년이 아닙니다.");
	}
}

반응형