Leap Year in JAVA programming



///Md. Alamgir Hossain
///Dept. of Computer Science & Engineering
///Jessore University of Science & Technology
package SolveProblem;

import java.util.Scanner;

public class LeaYear {

    public static void main(String[] args) {
        Scanner myScanner=new Scanner(System.in);
       
        int n;
        System.out.println("Enter the year : ");
        n=myScanner.nextInt();
       
        if ((n%400==0)||((n%4==0)&&(n%100!=0))) {
            System.out.println("The year "+n+" is leap Year");
        }
        else {
            System.out.println("The year "+n+" is not Leap Year");
        }
    }

}
//Enter the year :
//2012
//The year 2012 is leap Year

1 comment: