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

Make a GST Calculator using HTML and JavaScript

How to make simple bill maker by using python tkinter

Write a program to find the sum of 1/2+4/3+5/6+8/7+9/10 using loop in java