Program to check whether a year entered is a leap year or not.

PROGRAM :

import java.util.Scanner;
public class Leap {
         public static void main(String[] args) {
     
        System.out.println("enter the year to check whether it is leap year or not");
        Scanner s = new Scanner(System.in);
        int a;
        a= s.nextInt();
        if ( a % 4== 0 )
        System.out.println("the year entered is leap year");
        else
       System.out.println("the year is not a leap year");
}
}

No comments:

Post a Comment