-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLeapYear.java
More file actions
26 lines (25 loc) · 756 Bytes
/
LeapYear.java
File metadata and controls
26 lines (25 loc) · 756 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
import java.util.Scanner;
public class LeapYear {
public static void main(String [] args) {
Scanner user = new Scanner(System.in);
System.out.print("Enter year : ");
int year = user.nextInt();
user.close();
if(year % 4 == 0) {
if(year % 100 == 0) {
if(year % 400 == 0) {
System.out.println(year + " is a leap year.");
}
else {
System.out.println(year + " is not a leap year");
}
}
else {
System.out.println(year + " is a leap year.");
}
}
else {
System.out.println(year + " is not a leap year.");
}
}
}