-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLeap_year.java
More file actions
34 lines (28 loc) · 853 Bytes
/
Leap_year.java
File metadata and controls
34 lines (28 loc) · 853 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
import java.util.Scanner;
public class Leap_year {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter the year : ");
int year = scan.nextInt();
//check for leap year
/* if (year%4 ==0) {
System.out.println("leap year");
}*/
if(year%100==0) {
if (year%400==0){
System.out.println("leap year===");
//2000
}
else{
System.out.print("not leap");//1700,1800
}
}
else if (year%4==0){
System.out.println("leap year");//1996,2020
}
else {
System.out.println("Not a Leap Year....");
}
scan.close();
}
}