Create a program to judge the calendar.
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int reki = sc.nextInt();
String hantei = "";
if(reki%4==0){
hantei="leap year";
if(reki%400!=0 && reki%100==0){
hantei="Normal year";
}else{
hantei="leap year";
}
}else{
hantei="Normal year";
}
System.out.println(hantei);
}
}
//If you enter 1900, it will be normal
//Enter 2000 to get a leap year
//If you enter 2001, it will be normal
//Enter 2004 to get a leap year
Recommended Posts