package com;
import java.util.Scanner;
public class LeapYear {
public static void main(String[] args) {
int year;
Scanner
sc=new Scanner(System.in);
System.out.println("Enter any
Year");
year=sc.nextInt();
sc.close();
boolean LeapYear=false;
if(year%4==0)
{
if(year%100==0)
{
if(year%400==0)
LeapYear=true;
else
LeapYear=false;
}
else
LeapYear=true;
}
else {
LeapYear=false;
}
if(LeapYear==true)
System.out.println(year +"is a leap
year");
else
System.out.println(year +"is not a leap
year");
}
No comments:
Post a Comment