Skip to content

Instantly share code, notes, and snippets.

@ltagliaferri
Created February 21, 2014 05:45
Show Gist options
  • Save ltagliaferri/9129436 to your computer and use it in GitHub Desktop.
Save ltagliaferri/9129436 to your computer and use it in GitHub Desktop.
public class LeapYear {
public static void main (String args[]) {
int year = Integer.parseInt(args[0]);
if ((year % 4 == 0) && (year % 100 != 0)){
System.out.println(year + " is a leap year.");
}
else if ((year % 100 == 0) && (year % 400 == 0)){
System.out.println(year + " is a leap year.");
}
else{
System.out.println(year + " is not a leap year.");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment