P5711 judgment leap year

Enter a year (an integer greater than 1582), to determine whether the year is a leap year, if the output is 1, otherwise outputs 0.

Tip: leap year condition is established 

Divisible by 400

Or divisible by 4 but not divisible by 100

End Analyzing conditions can be directly output after the

Import Classes in java.util *. ;
 public  class the Main {
 public  static  void main (String [] args) {
         // method TODO automatically generated stubs 
     Scanner in = new new Scanner (the System.in);
        int year = in.nextInt ();
        IF (year> 1582 && year. 4% 100% year == 0 &&! = 0 == 0 || year 400% )
       {
           System.out.println("1");
       }else
       {
           System.out.println("0");
       }
    }
}

 

Guess you like

Origin www.cnblogs.com/coke-/p/12633694.html