-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLeapYear.java
More file actions
39 lines (35 loc) · 947 Bytes
/
LeapYear.java
File metadata and controls
39 lines (35 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaprograming;
/**
*
* @author rohan
*/
public class LeapYear {
public static void main(String[] args) {
int year = 1992;
boolean leap = false;
if (year % 4 == 0) {
if (year % 100 == 0) {
// year is divisible by 400, hence the year is a leap year
if (year % 400 == 0) {
leap = true;
} else {
leap = false;
}
} else {
leap = true;
}
} else {
leap = false;
}
if (leap) {
System.out.println(year + " is a leap year.");
} else {
System.out.println(year + " is not a leap year.");
}
}
}