Advertisement
Vexus

P5.5

Oct 17th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. package leapYear;
  2.  
  3. public class Year {
  4. public static void main(String[] args) {
  5.  
  6. int year = 2014;
  7. boolean leapYear = false;
  8. System.out.println("Enter a year to see if it is a leap year.");
  9. if (year > 5000)
  10. }
  11. System.out.println("Cannot find year over 5000."); {
  12. else
  13. }
  14. if (year % 4 == 0)
  15. {
  16. leapYear = true;
  17. if ((year % 100 == 0) && (year % 400 != 0)){ leapYear = false;}
  18. }
  19. }
  20. if (leapYear)
  21. System.out.println(year + " is a LeapYear.");
  22. else
  23. System.out.println(year + " is not a LeapYear.");
  24. System.out.println("Try a diffrent year.");
  25.  
  26.  
  27.  
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement