/**
*
*/
import java.io.*;
import java.util.*;
/**
*
*
*/
public class Leap {
/**
* @param args
*/
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
System.out.println("Enter the year to check whether it is leap year or not..!");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int Year = Integer.parseInt(br.readLine());
if((Year%400 == 0) && (Year%100 == 0)){
System.out.println("It is leap Year");
}
else if((Year%100 != 0) && (Year%4 == 0)){
System.out.println("It is leap Year");
}
else{
System.out.println("It is Not leap Year");
}
}
}
*
*/
import java.io.*;
import java.util.*;
/**
*
*
*/
public class Leap {
/**
* @param args
*/
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
System.out.println("Enter the year to check whether it is leap year or not..!");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int Year = Integer.parseInt(br.readLine());
if((Year%400 == 0) && (Year%100 == 0)){
System.out.println("It is leap Year");
}
else if((Year%100 != 0) && (Year%4 == 0)){
System.out.println("It is leap Year");
}
else{
System.out.println("It is Not leap Year");
}
}
}
Output :-
Enter the year to check whether it is leap year or not..!
2009
It is Not leap Year
No comments:
Post a Comment