Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Leap {
- static boolean LeapYear(int yr)
- {
- if(yr % 400 == 0)
- return true;
- if(yr % 100 == 0)
- return false;
- if(yr % 4 == 0)
- return true;
- return false;
- }
- public static void main(String args[])
- {
- Scanner sc = new Scanner(System.in);
- System.out.print("Enter the year : ");
- int year = sc.nextInt();
- if(LeapYear(year))
- System.out.print(year + " is a Leap Year!");
- else
- System.out.print(year + " is not a Leap Year!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement