-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathQ14.java
More file actions
25 lines (21 loc) · 705 Bytes
/
Q14.java
File metadata and controls
25 lines (21 loc) · 705 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
// program to check leap year
import java.util.Scanner;
public class Q14 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the year: ");
int year = sc.nextInt();
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");
}
sc.close();
}
}