Sunday, 20 March 2016

Leap Year

/*LeapYear*/

import java.io.*;
class leapyear
{
public static void main(String args[])throws IOException
{
int a;
DataInputStream l = new DataInputStream(System.in);
a=Integer.parseInt(l.readLine());
if(a%4==0)
{
  if(a%100==0)
   {
    
    if(a%400==0)
     {
       System.out.println("Leap Year");
     }
     else
     {
       System.out.println("Nota Leap Year");
      }
    }
  else
   {
    System.out.println("Leap Year");
    }
 }
else
{
 System.out.println("Not a Leap Year");
}
}
}
/*


OUTPUT

H:\>path=C:\jdk1.3\bin;

H:\>javac leapyear.java
Note: leapyear.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.

H:\>java leapyear
2015
Not a Leap Year

H:\>java leapyear
2012
Leap Year

H:\>

*/

No comments:

Post a Comment