Code:-
import java.util.Scanner;class Leap{
public static void main(String args[]){
System.out.println("Enter year");
Scanner s=new Scanner(System.in);
int a=s.nextInt();
if((a%100)==0){
if((a%400)==0)
System.out.println(a+" is a century year and a leap year too");
else
System.out.println(a+" is a century year");
}
else{
if((a%4)==0)
System.out.println(a+" is leap year ");
else
System.out.println(a+" is not a leap year");
}
}
}
No comments:
Post a Comment