How to know if Year is a Leap Year:
1. Leap years are any year that can be evenly divided by 4 (2012, 2016)
2. Except if it can be evenly divided by 100, then it’s not (2100, 2200)
3. Except if it can be evenly divided by 400, then it is leap year (2000, 2400)
import java.util.*;
class leapyear
{
public static void main(String args[])
{
int year;
Scanner sc=new Scanner(System.in);
System.out.println("Enter any year");
year=sc.nextInt();
if(year%4==0 && year%100!=0 || year%400==0)
System.out.println(year+"is a leap year");
else
System.out.println(year+"not a leap year");
}
}