Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package leapYear;
- public class Year {
- public static void main(String[] args) {
- int year = 2014;
- boolean leapYear = false;
- System.out.println("Enter a year to see if it is a leap year.");
- if (year > 5000)
- }
- System.out.println("Cannot find year over 5000."); {
- else
- }
- if (year % 4 == 0)
- {
- leapYear = true;
- if ((year % 100 == 0) && (year % 400 != 0)){ leapYear = false;}
- }
- }
- if (leapYear)
- System.out.println(year + " is a LeapYear.");
- else
- System.out.println(year + " is not a LeapYear.");
- System.out.println("Try a diffrent year.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement