Run Code  | Code Wall  | Users  | Misc  | Feedback  | About  | Login  | Theme  | Privacy 

Abc

      
            
                
            
 run  | edit  | history  | help 0

import java.util.Scanner; public class Demo {

   public static void main(String[] args) {

       int year;
       Scanner scan = new Scanner(System.in);
       System.out.println("Enter any Year:");
       year = scan.nextInt();
       scan.close();
       boolean isLeap = false;

       if(year % 4 == 0)
       {
           if( year % 100 == 0)
           {
               if ( year % 400 == 0)
                   isLeap = true;
               else
                   isLeap = false;
           }
           else
               isLeap = true;
       }
       else {
           isLeap = false;
       }

       if(isLeap==true)
           System.out.println(year + " is a Leap Year.");
       else
           System.out.println(year + " is not a Leap Year.");
   }

}

  by  Neha0311, 27 days ago




Please log in to post a comment.