Leap Year Program in Java

A day and night is 23 hours, 56 minutes and 4.1 seconds. It takes 365 days, 5 hours, 48 ​​minutes and 45 seconds for the Earth to complete one round of the sun.
In easy terms, the year that the remaining zero is divided by 4 will be a leap year, but only that century will be a leap year, which is completely divided by 400.


import java.util.Scanner;

public class LeapYear
{
    public static void main(String[] args)
    {
        int year;
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter a year=");
        year = sc.nextInt();
        if (((year % 400 == 0) || (year % 4 == 0)) && (year % 100 != 0))
        {
            System.out.println("Leap year.");
        }
        else
        {
            System.out.println("Not a leap year");
        }
    }
}


Output:

Enter a year=1600
Not a leap year
b. tech. bca icse java java tutorials learn java mca programs