Write a program to check a year is leap year or not in java

 Write a program to check a year is leap year or not in java

public class LeapYear
{
   public static void main(String args[]){
    int year=2013;
    if(year%4==0){
        if(year%100==0){
            if(year%400==0){
            System.out.println("LeapYear");
            }else{
            System.out.println("Not a LeapYear");
            }
        }else{
            System.out.println("LeapYear");
        }
    }else{
        System.out.println("Not a LeapYear");
    }
    }
}

Output
Not a LeapYear


Comments

Popular posts from this blog

Calculate Compound Interest in JavaScript

How to make simple bill maker by using python tkinter

Admin Login Page Using HTML and CSS