-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathleap.java
More file actions
40 lines (30 loc) · 720 Bytes
/
leap.java
File metadata and controls
40 lines (30 loc) · 720 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
40
import java.io.*;
class leap
{
public static void LeapYear(int year)
{
boolean leap_year = false;
if (year % 4 == 0)
{
leap_year = true;
if (year % 100 == 0)
{
if (year % 400 == 0)
leap_year = true;
else
leap_year = false;
}
}
else
leap_year = false;
if (!leap_year)
System.out.println(year + " : Non Leap-year");
else
System.out.println(year + " : Leap-year");
}
public static void main(String[] args)
{
LeapYear(2000);
LeapYear(2002);
}
}