ulvis.paste.net

Paste Search Dynamic
Recent pastes
Enter a valid year
  1. import java.util.Scanner;
  2. class Ideone {
  3.     public static void main(string args[]) {
  4.         int year;
  5.         Scanner scan = new Scanner (system.in);
  6.         system.out.println ("Enter a valid year after 1582, or 0 to end.");
  7.         year = scan.nextInt();
  8.         if ((year % 4 == 0) && (year % 100 != 0))
  9.         {
  10.             system.out.println (+year+ " is a leap year.");
  11.         }
  12.         else if (year % 100 == 0)
  13.         {
  14.             system.out.println (+year+ " is not a leap year.");
  15.         }
  16.         else if (year % 400 == 0)
  17.         {
  18.             system.out.println (+year+ " is a laep year.");
  19.         }
  20.         else
  21.         {
  22.             system.out.println (+year+ " is not a leap year.");
  23.         }
  24.  
  25.     }
  26. }
Parsed in 0.020 seconds