Skip to content

Instantly share code, notes, and snippets.

@jimmy087
Created May 4, 2013 12:42
Show Gist options
  • Save jimmy087/5517387 to your computer and use it in GitHub Desktop.
Save jimmy087/5517387 to your computer and use it in GitHub Desktop.
Display leap years
// Displaying leap years.
public class Exercise4_27 {
public static void main (String[] args) {
System.out.println("The following are the leap years");
System.out.println("--------------------------------");
int count = 0;
for (int i = 2000; i <= 2100; i++ ) {
if (i % 4 == 0) {
count++;
System.out.print((count % 10 != 0) ? i + " " : i +"\n" );
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment