A leap year is a year containing an extra day. It has 366 days instead of the normal 365 days.The extra day is added in February, which has 29 days instead of the normal 28 days.Leap years occur every 4 years. 2012 is a leap year and so is 2016.
Program Code :
import java.util.Scanner;public class LeapYearChecker{public static void main(String[] args){Scanner scn =new Scanner(System.in);int a;System.out.print("Enter the checking year = ");a=scn.nextInt();if(a%4==0)System.out.println(a+" is Leap Year");elseSystem.out.println(a+" is not Leap Year");}}
Output :
Enter the checking year = 2016
2016 is Leap Year