blob: f21b4b303fd7fe1e1193a84cbf6c00a074c7c130 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
package com.mycompany.app;
// Exercise 7
public class IsLeapYear
{
public static void main(String... args)
{
int n = Integer.parseInt(args[0]);
if (n % 4 == 0 && n % 100 != 0 || n % 400 == 0)
System.out.printf("%d is a leap year\n", n);
else
System.out.printf("%d is not a leap year\n", n);
}
}
|