Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. package tasks;
  2.  
  3. import java.util.Scanner;
  4.  
  5. /**
  6. * Created by Admin on 27.04.2017.
  7. */
  8. public class Years {
  9. public static void main(String[] args) {
  10. System.out.println("Input year and press enter: ");
  11. int year = new Scanner(System.in).nextInt();
  12. if ((year % 4 == 0) && year % 100 != 0) {
  13. System.out.println(year + " is a leap year.");
  14. } else if ((year % 4 == 0) && (year % 100 == 0) && (year % 400 == 0)) {
  15. System.out.println(year + " is a leap year.");
  16. } else {
  17. System.out.println(year + " is not a leap year.");
  18. }
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement